当我在 Debian 中重新启动 mysql 服务器时,总是会出现以下消息。如何让这些消息消失或修复问题/损坏的表?
debian:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
Linux/var/log/syslog
显示
Jul 18 12:27:57 localhost mysqld: 140718 12:27:57 [Note] /usr/sbin/mysqld: Normal shutdown
Jul 18 12:27:57 localhost mysqld:
Jul 18 12:27:57 localhost mysqld: 140718 12:27:57 [Note] Event Scheduler: Purging the queue. 0 events
Jul 18 12:27:57 localhost mysqld: 140718 12:27:57 InnoDB: Starting shutdown...
Jul 18 12:27:58 localhost mysqld: 140718 12:27:58 InnoDB: Shutdown completed; log sequence number 0 44233
Jul 18 12:27:58 localhost mysqld: 140718 12:27:58 [Note] /usr/sbin/mysqld: Shutdown complete
Jul 18 12:27:58 localhost mysqld:
Jul 18 12:27:58 localhost mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Jul 18 12:28:00 localhost mysqld_safe: Starting mysqld daemon with databases from /mnt/user/mysql
Jul 18 12:28:00 localhost mysqld: 140718 12:28:00 [Note] Plugin 'FEDERATED' is disabled.
Jul 18 12:28:00 localhost mysqld: 140718 12:28:00 InnoDB: Started; log sequence number 0 44233
Jul 18 12:28:00 localhost mysqld: 140718 12:28:00 [Note] Event Scheduler: Loaded 0 events
Jul 18 12:28:00 localhost mysqld: 140718 12:28:00 [Note] /usr/sbin/mysqld: ready for connections.
Jul 18 12:28:00 localhost mysqld: Version: '5.1.49-3~bpo50+1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Debian)
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11601]: Upgrading MySQL tables if necessary.
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11605]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11605]: Looking for 'mysql' as: /usr/bin/mysql
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11605]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11605]: This installation of MySQL is already upgraded to 5.1.49, use --force if you still need to run mysql_upgrade
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11611]: Checking for insecure root accounts.
Jul 18 12:28:01 localhost /etc/mysql/debian-start[11615]: Triggering myisam-recover for all MyISAM tables
答案1
不要遵循第一个答案,这是一个非常严重的问题。
如果你正确阅读了该行,你会发现没有问题,因为没有损坏的表或可以找到任何其他东西
“检查是否有损坏、未干净关闭和需要升级的表”,所以一切都正常。
答案2
对我来说有几个可行的选项。1)找到在你的 Debian 上运行的所有 MySql 进程:
ps -A | grep mysql
如果有正在运行的,则终止它:
kill -9 <ps_number which is second column number>
2)另一个选项是使用本地主机和典型端口号启动 mysql
sudo mysql -h 127.0.0.1 -P 3306 -u root -p <database>
https://stackoverflow.com/a/11658142/2523431
3)最野蛮的方法;卸载mysql并重新安装(在其他帖子上找到的解决方案,但是现在想不起链接来给予赞扬):使用以下命令:
sudo apt-get remove --purge mysql\*
您可以删除与名为 mysql 的软件包相关的任何内容。这些命令仅在基于 debian / debian 的 Linux 发行版(例如 ubuntu)上有效。您可以使用以下命令列出所有已安装的 mysql 软件包:
sudo dpkg -l | grep -i mysql
要进一步清理包缓存,您可以:
sudo apt-get clean
记得:
sudo updatedb
否则“locate”命令将显示旧数据。要再次安装 mysql,请使用以下命令:
sudo apt-get install libmysqlclient-dev mysql-client
这将安装 mysql 客户端、libmysql 及其头文件。要安装服务器,请运行以下命令:
sudo apt-get install mysql-server
其他人建议了其他选项,比如覆盖配置文件,但就我而言(我在基于 Debian 的 Kali Linux 上运行 mysql)没有帮助。
顺便说一句,不要忘记使用命令关闭系统:
shutdown -h now
这可以避免您将来再遭受更多不便。