linux安装mysql提示mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

时间:2022-04-24 03:57:01
输入命令后报错:
[root@dev1 mysql]# bin/mysqld_safe --user=mysql &
[1] 15325
[root@dev1 mysql]# 091217 22:22:53 mysqld_safe Logging to '/var/lib/mysql/dev1.sccl.cn.err'.
091217 22:22:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
091217 22:23:01 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[root@dev1 mysql5.1]# bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (1)

解决办法
vi /etc/my.cnf

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/lib/run/mysql/mysqld.pid
改成
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid

好现象,貌似启动成功了,插件进程
[root@dev1 log]# ps -aux | grep mysql
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
root     15526 0.0 0.0 5276 1112 pts/0    S    22:42   0:00 /bin/sh bin/mysqld_safe --user=mysql
mysql    15594 0.0 0.6 119232 14292 pts/0 Sl   22:42   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/dev1.sccl.cn.err --pid-file=/var/lib/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root     15613 0.0 0.0 5976 656 pts/0    S+   22:44   0:00 grep mysql

但是登陆还是报错,修改如下:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

登陆老是提醒我登陆的用户名和密码不对,我重新设置了一下密码
mysql -u root(默认密码为空)
登陆
登陆终于成功了:),好事多磨啊。