Solved

error - default character set when loading a sql-fil creating tables...

Posted on 2004-09-30
4
318 Views
Last Modified: 2012-06-22
Hi

Im trying to create a lot of tables by loading a sql-file. But each time it fails.
cat /create_itracker_core.sql | mysql itracker
ERROR 1064 at line 1: You have an error in your SQL syntax near 'CHARACTER SET utf8' at line 5

The file looks like:
create table IDSTORE (
  id                    VARCHAR(80)         PRIMARY KEY,
  name                  VARCHAR(80)         UNIQUE,
  last_id               VARCHAR(255)
) DEFAULT CHARACTER SET utf8;

If I remove the "DEFAULT CHARACTER SET utf8;" it works fine.

My /etc/my.cnf:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib
# set-variable  = default-character-set=utf8 # I have tried with this line enabled too..

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Im running on Linux Redhat 8                                    

Regards
Claes
0
Comment
Question by:cl071997
  • 2
  • 2
4 Comments
 

Expert Comment

by:bkirchle
ID: 12193287
In different Versions of MySQL you have different Syntax for the DEFAULT CHARSET....

When I upgraded from 3.23 to 4.1 I had the same problem.
I solved it by deleting all the DEFAULT CHARSET commands with a SED script.
0
 

Author Comment

by:cl071997
ID: 12197533
I see. I tried to load the tables without the "DEFAULT CHARACTER SET" and it worked fine.
But dont I need the character set when creating the tables?
Or can it be solved in my.cnf ?

Regards
Claes
0
 

Accepted Solution

by:
bkirchle earned 125 total points
ID: 12198088
You can also change to the right Syntax with a SED script, i think...
0
 

Author Comment

by:cl071997
ID: 12199140
OK.
Its up and running now and we will find out if the default character set is needed or not.

Many thanks for you help.

Regards
Claes
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Clean text to insert in database 9 63
Magneto product importing through API script 10 62
configure dependency in POM for new database 3 25
Mysql Left Join Case 10 54
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question