/var/lib/mysql/localhost.localdomain.pid【mysql服务启动出错】

本文详细记录了在CentOS7系统中安装MySQL5.6.36的具体步骤,并分享了解决启动错误及权限表不存在等问题的实用方法,通过执行特定命令,成功初始化数据库并设置随机密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

centos 7安装mysql-5.6.36

mysql安装过程见:https://blog.youkuaiyun.com/qq_31073717/article/details/80635037

1.启动mysql提示出错

./mysql start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

2.从日志中找到两条错误

[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

 

在网上找到相关解决方法,直接输入

mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/

回车就好了,出现下面的信息:

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.


You can start the MySQL daemon with:

  cd /usr ; /usr//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr//my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

 

完美解决。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值