CentOS MySQL Error: Can ' t connect to MySQL server

Source: Internet
Author: User

Original link:

Http://www.centoscn.com/CentosBug/softbug/2015/0622/5709.html

Problem Description:

Using client Telnet connection on a CentOS 6.5 server based on MySQL, error: Can ' t connect to MySQL server on ' XXX ' (13)

Workaround:

In general, you can set the following
1. Go to MySQL Console
# mysql-u Root-p

2. Enter the following command in the MySQL console
Mysql> Grant all privileges on * * to ' root ' @ ' Your-host-ip ' identified by ' Your-mysql-password ' with GRANT option;
mysql> flush Privileges;
Mysql> exit

3. Restart MySQL
#/etc/init.d/mysqld Restart
At this point, no unexpected changes have been completed and validation passed.

However, if you still see the error message of Can ' t connect to MySQL server on ' XXX ' (13), you can try the following methods:

1. See if the value of Httpd_can_network_connect is off (for example: httpd_can_network_connect---off)
# Getsebool-a | grep httpd

2. Change the value of Httpd_can_network_connect to ON
# Setsebool Httpd_can_network_connect 1

3. Re-verify Httpd_can_network_connect
# Getsebool-a | grep httpd

4. Restart HTTP
#/etc/init.d/httpd Restart

5. Enter Client Restart login verification
At this point the error message changes to: Access denied for user ' root ' @ ' Your-host-ip ' (usring password:yes)

6. Go to MySQL console to re-grant (as above)

CentOS MySQL Error: Can ' t connect to MySQL server

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.