Bug #21257 problem with mysqlimport
Submitted: 24 Jul 2006 17:16 Modified: 9 Feb 2007 10:07
Reporter: Aaron Bliss Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:mysql -4.1.20-1.RHEL4.1 OS:Linux (redhat es 4)
Assigned to: Assigned Account CPU Architecture:Any

[24 Jul 2006 17:16] Aaron Bliss
Description:
mysqlimport: Error: You have an error in your SQL syntax near 'character_set_database=binary' at line 1

When attempting to import data into tables from the command line, i get the above error; reverting rpm back to mysql-4.1.7-4.RHEL4.1 has me up and running again; here is the exact syntax that I'm using for the import:

mysqlimport --protocol=tcp -P 8080 -u user1 --password=mypassword --local --columns 'report_time, server_name, source_user, source_ip, report_date' --fields-terminated-by ',' linux_audit_tmp /tmp/log_lnx/ssh_login >> /tmp/mysql_load

How to repeat:
everytime when running the above import when using the mysql client version of mysql -4.1.20-1.RHEL4.1
[25 Jul 2006 6:49] Sveta Smirnova
Thank you for the report.

I can not repeat it using last 4.1.22 BK sources and test data. Could you please provide output of SHOW CREATE TABLE ssh_login; and first 10 strings from the file /tmp/log_lnx/ssh_login.
[25 Aug 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[8 Jan 2007 13:27] Frits Brusse
Have found that the error is caused by a patch that contains :

-- 1.51/client/mysqlimport.c	2005-09-07 15:49:57 -07:00
+++ 1.52/client/mysqlimport.c	2005-10-25 14:49:54 -07:00
@@ -517,6 +517,13 @@
     free_defaults(argv_to_free);
     return(1); /* purecov: deadcode */
   }
+
+  if (mysql_query(sock, "set @@character_set_database=binary;"))
+  {
+    db_error(sock); /* We shall countinue here, if --force was given */
+    return(1);
+  }
+
   if (lock_tables)
     lock_table(sock, argc, argv);

We try to import data in a "old" mysql-server version
that doesn't understand character-sets.
(Server version:  3.23.49-log)

the --force option does not fix this problem for us.
Maybe the --force option could be fixed , or some other parameter so we can tell mysqlimport NOT to set the default character set.

Or maybe some check on version of mysql-server and then skip this character-set command ?
[9 Jan 2007 10:07] Sveta Smirnova
Aaron, do you import data to MySQL server older than 4.1 too?

Frits, your case is not a bug. We are not support MySQL 3.23 and can not guarantee compatibilites between new packages and older server. See also http://www.mysql.com/company/legal/lifecycle/#calendar
[10 Feb 2007 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".