安装mysql到mysql_safe时卡住了半天

浪费了我半天的时间,最后终于给我找到了答案!!!

我也不知道装mysql 会出现mariadb的字眼,可是报错就是这样来了。。

输入命令后报错:
[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(默认密码为空)
登陆
登陆终于成功了:),好事多磨啊。

我改了那个my.cnf文件后重启就OK了 ,必须记起来。。

你可能感兴趣的:(Mysql相关)