Can t connect to MySQL server FAQs

Source: Internet
Author: User
Tags mysql tutorial

Show when connecting to database tutorialCan't connect to MySQL server (10060 ),Follow these steps:

1. The network is disconnected.

Check whether the ping is successful.

2. Firewall settings.

Whether the firewall has spared the mysql tutorial process and blocked port 3306 of mysql.

3. mysql account settings.

Whether the mysql account cannot be remotely connected. If the connection fails, try the following methods:

Mysql-u root-p // log on to MySQL
Mysql> grant all privileges on *. * TO 'root' @ '%' with grant option; // any remote host can access the database.
Mysql> flush privileges; // you need to enter the command to make the modification take effect.
Mysql> EXIT // EXIT

You can also modify the table to remotely:

Mysql-u root-p

Mysql> use mysql;
Mysql> update user set host = '%' where user = 'root ';
Mysql> select host, user from user;

Can't connect to MySQL server on 'localhost'
Error No.: 2003

Problem Analysis:

Unable to connect to the MySQL server, possible situation:

1. the MySQL service is not started. It is generally caused by the failure of MySQL to start in case of exceptions, such as no available disk space or incorrect basedir path setting of MySQL in my. ini;

2. the MySQL server cannot be connected due to insufficient resources.


Solution:

1. If you are a VM user (purchased space), contact the Space Provider to check whether MySQL is started normally and confirm the MySQL configuration information (whether it is localhost );

2. If you are an independent host user (with host management permissions), perform the following steps:

1) check whether the MySQL service is started.

For a Windows host, right-click my computer, click manage, and find the MySQL service in the services and applications to check whether it is in the enabled status.


Can't connect to MySQL server on 'localhost' (10061) Solution


I copied the mysql database to another machine today and the result could not be connected. The error "Can't connect to MySQL server on 'localhost' (10061)" is reported.
Search online and find that an article is good. Both methods can solve this problem.
1. delete my. ini (in C: windows) and run winmysqladmin again. After Entering the user name and password, the problem is solved!
2. Check whether the localhost In the hosts file points to 127.0.0.1.
If the mysql service is not started, you can run net start mysql.
Some related commands:
Mysqld-nt -- install # Start Mysql
Mysql # Run Mysql
Mysql-h ipAddress-u username-p

 

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.