您的位置:首页 > 博客中心 > 数据库 >

mysqldump:Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1'问题

时间:2022-03-14 04:28

1、问题描述

    使用mysqldump备份,备份命令:

[root@gfsunny105 opt]# mysqldump -uroot -p  --skip-quote-names --databases test --tables t >test1.sql

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)

2、问题探索

2.1更改参数SQL_QUOTE_SHOW_CREATE状态值

mysql> show variables like ‘SQL_QUOTE_SHOW_CREATE‘;

+-----------------------+-------+

| Variable_name         | Value |

+-----------------------+-------+

| sql_quote_show_create | ON    | 

+-----------------------+-------+

1 row in set (0.01 sec)


mysql> set global sql_quote_show_create=off;

Query OK, 0 rows affected (0.00 sec)


mysql> exit

Bye

    继续执行上述备份,问题依旧。

2.2版本查询

查询mysql当前版本:

mysql> select version();

+-----------+

| version() |

+-----------+

| 5.6.20    | 

+-----------+

1 row in set (0.00 sec)

查询系统中是否有遗留安装包:

[root@gfsunny105 opt]# rpm -qa|grep -i mysql

mysql-5.0.95-5.el5_9

MySQL-python-1.2.3-0.1.c1.el5

可以看到,这里有mysql5.0的安装包存在。

2.3尝试从mysqldump源路经执行备份

查看mysqldump位置:

[root@gfsunny105 opt]# which mysqldump

/usr/bin/mysqldump

再次备份,ok。

[root@gfsunny105 opt]# /usr/local/mysql/bin/mysqldump -uroot -p  --skip-quote-names --databases test --tables t >test1.sql

3、解决办法

[root@gfsunny105 bin]# ls -l mysqldump 

-rwxr-xr-x 1 root root 66860 Jan 23  2013 mysqldump

[root@gfsunny105 bin]# date

Wed Dec 31 11:39:37 CST 2014

[root@gfsunny105 bin]# rm -f /usr/bin/mysqldump 

[root@gfsunny105 bin]# cp /usr/local/mysql/bin/mysqldump /usr/bin/

[root@gfsunny105 bin]# /usr/local/mysql/bin/mysqldump -uroot -p  --skip-quote-names --complete-insert --databases test --tables t >test1.sql

Enter password: 

[root@gfsunny105 bin]# 

    删除/usr/bin目录下的mysqldump,把/usr/local/mysql/bin目录下的mysqldump拷贝过去,问题解决。


热门排行

今日推荐

热门手游