The error "CantconnecttolocalMySQLserverthroughsocketvarlibmysqlmysql. sock (2)" occurs in mysql.
1 because the root user name and password accidentally forgot, but through a way of http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html Online appear Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) error, strange, mysql obviously started
1. the root user name and password have been accidentally forgotten, but you can
Http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html
Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) error, strange, mysql obviously started, had to change to another way
2. Use phpmyadmin
(1) Modify MySQL Logon Settings:
# Vi/usr/local/mysql/my. cnf
In the [mysqld] section, add skip-grant-tables.
(2) Restart mysqld
/Etc/init. d/mysqld restart
(3) log on to phpmyadmin
Log on to phpmyadmin with the root account, click mysql on the left to enter the mysql database, and click mysql on the top to enter the SQL input interface. Enter the following command:
Update user set password = password ('20140901') where User = 'root'
Among them, 123456 is the password you want to change. Remember not to manually change the password in the database.