故障现象:
今天使用MySQLdump备份数据库时,出现以下错误:
【mysqldump -uroot -p’Dbapp@2024’ --all-databases --single-transaction --master-data=1 --flush-logs > /mysqldump/date +%F-%H
mysql.sql】 //这是我使用的备份命令。
mysqldump: [Warning] Using a password on the command line interface can be insecure. //这个报错主要是因为我使用了明文方式填写密码。
mysqldump: Error: Binlogging on server not active;
解决方式:
1、在网上看了很多的文档都说在/etc/my.cnf里面添加一条log_bin=mysql-bin。然后重启数据库服务。
systemctl restart msqld
2、之后又出现一下报错:
Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
3、最终综合了其他网络上说的问题,再次在/etc/my.cnf里面添加了另外一条命令:server-id=1 //设置 MySQL 服务器的唯一标识符
然后成功重启数据库。