报错信息:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


[root@mysql5 ~]# mysql -uroot -pxxxx

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[root@mysql5 ~]# 

[root@mysql5 ~]# 

[root@mysql5 ~]# 

[root@mysql5 ~]# service mysqld3306 restart

 ERROR! MySQL server PID file could not be found!

Starting MySQL. ERROR! The server quit without updating PID file (/data/mysql3306/data/mysql5.5.pid).

[root@mysql5 ~]# 

确定是配置文件有错误,注意查看配置的更改:

[root@mysql5 ~]# 

[root@mysql5 ~]# service mysqld3306 start  

Starting MySQL. ERROR! The server quit without updating PID file (/data/mysql3306/data/mysql5.5.pid).

[root@mysql5 ~]# 

[root@mysql5 ~]# vi /etc/my.cnf

[root@mysql5 ~]# service mysqld3306 start

Starting MySQL.. SUCCESS! 

[root@mysql5 ~]# 

其实我们可以通过查看报错日志来确定是哪里的错误:

-----------------------------------------------------------------------------

150815 03:23:07 mysqld_safe mysqld from pid file /data/mysql3306/data/mysql5.5.pid ended

150815 03:23:16 mysqld_safe Starting mysqld daemon with databases from /data/mysql3306/data

150815  3:23:16 [Note] Plugin 'FEDERATED' is disabled.

150815  3:23:16 [Note] Plugin 'InnoDB' is disabled.

150815  3:23:16 [ERROR] Unknown/unsupported storage engine: InnoDB

150815  3:23:16 [ERROR] Aborting


150815  3:23:16 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete


-----------------------------------------------------------------------------

也可以是其他的报错信息,注意查找error报错信息即可。