Can & #39; change the root user name when tconnecttolocalMySQLserver

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.