Link to home
Start Free TrialLog in
Avatar of cl071997
cl071997

asked on

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

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
Avatar of bkirchle
bkirchle

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.
Avatar of cl071997

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of bkirchle
bkirchle

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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