PHP Run hints can ' t connect to MySQL server on ' localhost ' solution _mysql

Source: Internet
Author: User

Error Number:2003

Problem Analysis:

Unable to connect to the MySQL server, as possible:

1, the MySQL service does not start, generally in the case of the exception of MySQL can not start, such as no available disk space, My.ini mysql basedir path set error, etc.

2, the MySQL server resource is tight, causes cannot connect.

Workaround:

1, if you are a virtual host user (buy space), then contact space to check whether MySQL normal startup, and confirm MySQL configuration information (whether for localhost);

2, if you are a stand-alone host user (with administrative host permissions), then follow the steps below to check:

1 Check whether 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 it is in a started state.

Linux host, perform service at console MySQL start start MySQL service.

2 Check disk space for 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 set is correct, and then restart the MySQL service.

4 If the occasional normal display after refreshing and the server is a Windows system, then reduce windows TcpTimedWaitDelay time to resolve such problems, By default 240 (also this value is not set) This setting needs to be set up in the following registry location Hkey_local_machine\system\currentcontrolset\services\tcpip\ Parameters\tcptimedwaitdelay If this item is not tcptimedwaitdelay in the registry, add this item and set the double byte (DWORD) type value to 30 ~ 60

Related Article

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.