Solved

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

Posted on 2004-09-30
4
316 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now