This article introduces the content about php myadmin prompt #2002 Unable to log in to the MySQL server. It has certain reference value. Now I share it with everyone. Friends in need can refer to it
The login account and password are correct, but it prompts that the MySql server cannot be connected. Use the following steps to determine the error
Recommended related mysql video tutorials: "mysql tutorial"
一, it is possible to open multiple MySQL software, check whether there are multiple MySQLs in the background, and close them
2. (Online reference):
Question:
A MySQL client can connect to the mysqld server in two different ways: Unix socket, which connects through a file in the file system (default "/tmp/mysqld.sock") ; or TCP/IP, which connects through a port number. Unix sockets are faster than TCP/IP, but can only be used to connect to servers on the same computer. If you do not specify a hostname or if you specify the special hostname localhost, a Unix socket is used.
Error (2002) Can't connect to... usually means that there is not a MySQL server running on the system or that you are using the wrong socket when trying to connect to the mysqld server Interface file or TCP/IP port.
# Check (using ps) that there is a process named mysqld started on your server! If there isn't any mysqld process, you should start one.
Method 1:
Solution.#2002 Unable to log in to the MySQL server
Copy config.sample.inc.php to config.inc.php
This error occurs, indicating that it is not connected to the database. Modify the config.inc.php file,
1. 将$cfg['Servers'][$i]['host'] = 'localhost'; 改为$cfg['Servers'][$i]['host'] = '127.0.0.1';
or
修改 php.ini : mysql.default_socket = /tmp/mysql.sock
to get it done
Method 2:
phpMyAdmin cannot log in. After entering the user name and password and clicking "Execute", it keeps reporting "#2002 Unable to log in to the MySQL server".
Solution: Change
$cfg['Servers'][$i]['host'] = 'localhost' ;
in the config.default.php file under the "phpMyAdmin/libraries" folder to
$cfg['Servers'][$i]['host'] = '127.0.0.1' ;
3. When the problem cannot be solved: It is judged that there is a problem with the system
Try to start mysql through the command line
2) Check whether there is any remaining available disk space and try to keep enough disk space available.
3) Check whether the parameters such as basedir (MySQL installation address) and datadir (data directory storage address) in my.ini are set correctly, and then restart the MySQL service.
4) If the display can occasionally be normal after refreshing and the server is a Windows system, then reducing the TcpTimedWaitDelay time in Windows can solve such problems. The default is 240 (this is also the value if it is not set) )
This setting needs to be set in the following location of the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelay
If there is no TcpTimedWaitDelay item in the registry, please Add this item and set it to double-byte (DWORD) type and set the value to between 30 ~ 60
The above is the detailed content of php myadmin prompt #2002 Unable to log in to the MySQL server. For more information, please follow other related articles on the PHP Chinese website!