PHP myadmin prompt #2002 Unable to log on to MySQL server

Source: Internet
Author: User
Tags phpmyadmin myadmin
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, through the following steps to determine the error place


One, may open multiple MySQL software, the background to find out if there are multiple MySQL, and turn it off

Second, (online reference):


Problem:

a MySQL customer can connect to a MYSQLD server in two different ways: a UNIX socket, which is connected by a file in the file system (the default "/tmp/mysqld.sock"), or TCP/IP, which is connected by a port number. UNIX sockets are faster than TCP/IP, but are used only on servers that connect to the same computer . If you do not specify a host name or if you specify a special hostname, localhost, use a UNIX socket.

Error (2002) Can ' t connect to ... Usually means that no MySQL server is running on the system or when trying to connect to the MYSQLD server, you are using an incorrect socket file or TCP/IP port.

By checking (using PS) on your server there is a process called mysqld to start! If there is no mysqld process, you should start one.

Method One:

resolve. #2002 cannot log on to the MySQL server


Copy the config.sample.inc.php into config.inc.php
This error indicates that no connection to the database has occurred. Modify the config.inc.php file,




[plain] view plain copy


    1. Will $cfg[' Servers ' [$i] [' host '] = ' localhost ';   Instead of $cfg[' Servers ' [$i] [' host '] = ' 127.0.0.1 ';

Or

Modify Php.ini:mysql.default_socket =/tmp/mysql.sock

Get



Method Two:




phpMyAdmin unable to log in, entered the user name and password after clicking "Execute" has been reported "#2002 unable to log on to the MySQL server."


Workaround, place the config.default.php file in the "Phpmyadmin/libraries" folder

$cfg [' Servers '] [$i] [' host '] = ' localhost ';

Revision changed to

$cfg [' Servers '] [$i] [' host '] = ' 127.0.0.1 ';



Three, can not solve the problem: judgment is the system has a problem

Try to start MySQL from the command line


Start cmd under the Bin folder

Enter the login password, determine whether to start the success, if the failure is a problem with MySQL

Make the following workaround



1, the MySQL service does not start, generally in the case of abnormal MySQL can not start, such as no disk space available, My.ini mysql basedir path settings error, etc. 2, MySQL server resources are strained, resulting in the inability to connect. WORKAROUND: 1, if you are a virtual host user (purchase space), then contact the space provider to check whether MySQL startup, and confirm the MySQL configuration information (whether localhost), 2, if you are independent host users (with administrative host permissions), Follow the steps below to check: 1) Check if the MySQL service is started. Windows host, right click on My Computer, click Manage, find the MySQL service in the service and application to see if the status is started.
linux host, perform service on console MySQL start to start the MySQL service. 2) Check the disk space for any remaining free space and try to keep enough disk space available. 3) Check the My.ini basedir (MySQL installation address) and DataDir (data directory storage address) and other parameters are set correctly, and then restart the next MySQL service. 4) If the server is a Windows system that occasionally displays properly after a refresh, reducing tcptimedwaitdelay time in Windows resolves such problems, The default is 240 (this value is not set) This setting needs to be set to the registry at the following location hkey_local_machine\system\currentcontrolset\services\tcpip\ Parameters\tcptimedwaitdelay if the registry does not have tcptimedwaitdelay this item, please increase this item and set it to double-byte (DWORD) type numeric value set to 30 ~ 60 can be related to the recommendation: 

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.