几天前我让brew更新我所有的配方师,但这次mysqld并没有重新开始。
这是错误消息:
2016-03-22T13:58:22.515719Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-03-22T13:58:22.515819Z 0 [ERROR] Aborting
但是由于我无法启动服务器,我无法运行mysql_upgrade:
mysql_upgrade: Got error: 2013: Lost connection to MySQL server at 'reading initial communication packet', system error: 102 while connecting to the MySQL server
Upgrade process encountered error and will not continue.
那么我该怎样做才能让它再次运作?请问brew uninstall mysql
并以任何方式重新安装帮助吗?
答案 0 :(得分:30)
首先,在不读取用户表的情况下启动mysql:
mysqld --skip-grant-tables
然后运行mysql_upgrade
,现在应该顺利运行。
接下来停止mysqld:killall mysqld
。
现在你应该能够再次正常启动你的mysql服务。
答案 1 :(得分:3)
我最终重命名了我的数据库文件夹,运行mysql_install_db
,将新的mysql
数据库文件夹复制到我的旧mysql数据库文件夹并再次启动它。我确定这是很好的,但很好,它有效:)
答案 2 :(得分:0)
以下代码可以解决您的问题
jest