linux安装完mysql后启动错误

redhat as 4,使用rpm包安装完mysql的server 跟client后执行以下命令出错。

[root@ftp etc]# /usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

提示 以上错误时执行

/usr/local/mysql/bin/mysqld_safe & service mysql start 即可。

(如果你的mysql目录没有安装在/usr/local/mysql下,则执行/usr/bin/mysqld_safe & service mysql start即可)

使用netstat -na查看,发现mysql的3306端口已经启动了

[root@ftp local]# netstat -na
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address                Foreign Address              State       
tcp         0       0 0.0.0.0:32771                0.0.0.0:*                    LISTEN       
tcp         0       0 0.0.0.0:3306                 0.0.0.0:*                    LISTEN       
tcp         0       0 0.0.0.0:111                  0.0.0.0:*                    LISTEN       
tcp         0       0 0.0.0.0:627                  0.0.0.0:*                    LISTEN       
tcp         0       0 :::22                        :::*                         LISTEN       
tcp         0     232 ::ffff:222.194.76.37:22      ::ffff:123.233.213.223:1887 ESTABLISHED
udp         0       0 0.0.0.0:1024                 0.0.0.0:*                                
udp         0       0 0.0.0.0:621                  0.0.0.0:*                                
udp         0       0 0.0.0.0:111                  0.0.0.0:*                                
udp         0       0 0.0.0.0:624                  0.0.0.0:*                              


你可能感兴趣的:(localhost,password,linux安装)