Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best database setup for image uploads 6 50
Magneto product importing through API script 10 54
MySQL Init Waits 25 78
How to set up data replication from SQL Server to MySQL? 5 39
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

911 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

19 Experts available now in Live!

Get 1:1 Help Now