1、备份的时候出现2002报错,找不到/tmp/mysql.sock,这个文件
[[email protected] backup]# mysqldump -uroot -ppassword cz-office > mysql38.sql
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 2002: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2) when trying to connect
解决方法:可以先[[email protected] backup]# ps aux|grep mysql
mysql 20776 0.0 0.7 1824384 56928 ? Sl Feb26 2:29 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local//mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/usr/local//mysql/data/centos199.pid --socket=/var/lib/mysql/mysql.sock ,,
直接做一个软连接就可以解决,[[email protected] backup]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
2、备份的时候报这个错是因为mysqldump命令版本的问题,
[[email protected] backup]# mysqldump -uroot -ppassword cz-office > mysql38.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)
解决方法:
[[email protected] ~]# which mysqldump
/usr/bin/mysqldump
[[email protected] ~]# mysqldump --version
mysqldump Ver 10.13 Distrib 5.1.71, for Linux (x86_64)
如果你安装的MySQL是5.6以上的版本遇到这种问题,直接将你所安装MySQL目录下的mysqldump这个命令,cp到/usr/bin/下就行
[[email protected] bin]# pwd
/usr/local/mysql/bin
[[email protected] bin]# cp mysqldump /usr/bin/mysqldump
[[email protected] bin]# mysqldump -V
mysqldump Ver 10.13 Distrib 5.6.32, for Linux (x86_64)
3,、备份的时候报错显示密码不安全的问题
[[email protected] mysql]# mysqldump -uroot -ppassword cz-office > mysql38.sql
Warning: Using a password on the command line interface can be insecure.
解决方法:mysql -u root -ppassword 改成mysql -u root -p 在输入密码即可
如果有不对的地方,欢迎大家指出,谢谢!