在用mysqldump导出时报如下错误:
[root@localhost ~]# mysqldump -uroot -p -d -R test > test.sql
Enter password:mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line 1 (1064)
经查是mysqldump版本问题,运行的mysql server是5.6.13 ,在使用yum安装dbd驱动时自动安装了5.0.9的mysql rpm包:
[root@localhost ~]# mysqldump --version
mysqldump Ver 10.11 Distrib 5.0.95, for redhat-linux-gnu (x86_64)
[root@localhost ~]# which mysqldump
/usr/bin/mysqldump
用5.6版本的mysqldump覆盖或者指定目录运行即可:
[root@localhost ~]# cp /MysqlData/base/mysql/bin/mysqldump
/usr/bin/mysqldump
cp:是否覆盖“/usr/bin/mysqldump”? y