mysql> system mysqldump -uroot -p -B mingongge >/root/mingongge_bak.sql
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
由于mysql默认的sock路径是'/var/lib/mysql/mysql.sock 但是我查了一下自己安装指定的mysql sock路径 是 /opt/mysql/mysql.sock
此时只需要做一个链接指向默认的路径就可以了
再次执行备份命令
mysql> system mysqldump -uroot -p123 -B mingongge >/root/mingongge_bak.sql
Warning: Using a password on the command line interface can be insecure.
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.
查看备份是否成功:
至此故障解决。