Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 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