Home > Backend Development > PHP Tutorial > php myadmin prompt #2002 Unable to log in to the MySQL server

php myadmin prompt #2002 Unable to log in to the MySQL server

不言
Release: 2023-03-24 15:04:02
Original
11779 people have browsed it

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';
Copy after login

or

修改 php.ini : mysql.default_socket = /tmp/mysql.sock
Copy after login

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'
;
Copy after login

in the config.default.php file under the "phpMyAdmin/libraries" folder to

$cfg['Servers'][$i]['host'] = 
'127.0.0.1'
;
Copy after login

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


## Start cmd in the bin folder

Enter Login password to determine whether the startup is successful. If it fails, there is a problem with mysql.

Make the following solutions

1) On the Linux host, execute service mysql start on the console to start the MySQL service.

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template