MySQL Remote connection Timeout workaround

Source: Internet
Author: User

Tag: src mic buffer realizes landing my.cnf mil effect image

set MySQL remote connection root permissionsin the remote connection to MySQL should have encountered, the root user can not connect to the remote MySQL, only local connection, foreign refused to connect. You need to establish a database account that allows remote logins so that you can operate the database remotely. Here's how:by default, the MySQL database system database MySQL system table user rights within users only provide localhost native login;you need to change permissions to enable remote connection to the MySQL database. This can be confirmed by the following methods:root#mysql-h localhost-uroot-pEnter Password: ******Welcome to the MySQL Monitor. Commands End With; or \g.Your MySQL Connection ID is 4 to server Version:4.0.20a-debugType ' help ', ' or ' \h ' for help. Type ' \c ' to clear the buffer.mysql> use MySQL; (This DB holds various configuration information for MySQL)Database changedmysql> Select Host,user from user; (View the user's permission condition)mysql> Select Host, user, password from user;+-----------+------+-------------------------------------------+| host | user | password |+-----------+------+-------------------------------------------+| localhost | root | *4acfe3202a5ff5cf467898fc58aab1d615029441 || 127.0.0.1 | root | *4acfe3202a5ff5cf467898fc58aab1d615029441 || localhost | | |+-----------+------+-------------------------------------------+4 rows in Set (0.01 sec)As you can see, you can only access it as a host of localhost. Workaround:mysql> Grant All privileges on * * to ' root ' @ '% ' identified by ' kdm001 ' with Grant option;(% means all external machines, if a certain machine is specified, the% is changed to the corresponding machine name; ' root ' means the username to be used.) mysql> flush privileges; (Run this sentence to take effect, or restart MySQL)Query OK, 0 rows affected (0.03 sec)Check again: mysql> Select Host, user, password from user;+-----------+------+-------------------------------------------+| host | user | password |+-----------+------+-------------------------------------------+| localhost | root | *4acfe3202a5ff5cf467898fc58aab1d615029441 || 127.0.0.1 | root | *4acfe3202a5ff5cf467898fc58aab1d615029441 || localhost | | ||% | root | *4acfe3202a5ff5cf467898fc58aab1d615029441 |+-----------+------+-------------------------------------------+4 rows in Set (0.01 sec)It can be seen that a new user has been addedquit, try the effect ....you are now ready to log in successfully .

PS: If you can't sign in yet, see below

1. Remember to turn off VMware or Linux firewalls

2. Open the/etc/my.cnf file, bind-address = ******** A sentence preceded by #, comment out

Add two more sentences:

Skip-external-locking
Skip-name-resolve

3. Restart Mysql:service mysql Restart

4. The remote connection should be able to connect to the

MySQL Remote connection Timeout workaround

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.