Sometimes when we use commands such as "MySQL", "mysqladmin", "mysqldump" to manage the database, the server throws an error similar to the following:
1
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket
As shown below, PHP connection MySQL error:
SQLSTATE[HY000] [2002] Can ' t connect to local MySQL server through socket ' MySQL ' (2)
The test code is as follows:getmessage ();}" Solutions "Change host=localhost to host=127.0.0.1 !
Installing MySQL on Linux sometimes appears [Mysql]error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.so CK ' (2) Such a mistake, the specific solution is as follows:[Email protected] ~]#
After installing MySQL connection error:[[email protected] app]# Mysqlerror 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql . Sock ' (2) [[email protected] app]# mysql-uroot-penter Password:error 2002 (HY000):
As shown below, PHP connection MySQL error:
SQLSTATE[HY000] [2002] Can ' t connect to the local MySQL server through socket ' MySQL ' (2)
The test code is as follows:
Try{$dsn = ' Mysql:dbname=php-note;host=localhost;port=3306;charset=utf8
1. Turn off the MySQL service:Service Mysqld Stop2. Create a new directoryMkdir-p data3. Transfer the previous directory to the new data directorymv/var/lib/mysql//data/4, edit my.cnfVi/etc/my.cnfModify the DataDir and socket to a new
This article is about the PHP myadmin hint #2002 can not log on to the MySQL server, has a certain reference value, now share to everyone, the need for friends can refer to
Login account password is correct, prompt can not connect to MySQL server,
ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock ' (2)Error:Input#mysql-U root-pERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock ' (2)Scenario 1
After installing MySQL, after using the new configuration file, the MySQL server can start successfully, but at the time of login error 2002 (HY000): Can ' t connect to local MySQL server through socket, That is, you cannot connect to the MySQL
After the MySQL is installed, the MySQL server can start successfully after using the new configuration file, but the error 2002 (HY000) appears when landing: Can ' t connect to the local MySQL server through socket, That is, unable to connect to
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.