1、備份mysql資料庫時候出錯,導出資料:
[root@localhost ~]# mysqldump -uroot -p mysql >/root/bck.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)
2、查詢是否mysqldump版本問題:
[root@localhost ~]# mysqldump --version
mysqldump ver 10.13 distrib 5.1.71, for redhat-linux-gnu (x86_64)
[root@localhost ~]# which mysqldump
/usr/bin/mysqldump
3、用5.6.23版本的mysqldump覆寫或者指定目錄運作即可
[root@localhost mysql]# cp /opt/mysql/mysql-5.6.23-linux-glibc2.5-x86_64/bin/mysqldump /usr/bin/mysqldump
cp: overwrite `/usr/bin/mysqldump'? y
4、檢視是否備份成功:
[root@localhost mysql]# mysqldump -uroot -h127.0.0.1 -p test > /root/1.sql
[root@localhost ~]# cat 1.sql
drop table if exists <code>sc</code>;
/!40101 set @saved_cs_client = @@character_set_client /;
/!40101 set character_set_client = utf8 /;
create table <code>sc</code> (
<code>scid</code> int(12) not null auto_increment,
<code>cno</code> int(10) not null,
<code>sno</code> int(10) not null,
<code>grade</code> tinyint(2) not null,
primary key (<code>scid</code>)
.....................