Correct MySQL remote connection Configuration

Source: Internet
Author: User
Tags mysql host

This article mainly describes the actual operation steps of MySQL remote connection configuration and the relevant matters worth attention in its actual operations. The following describes the specific solution, I hope this will help you in your future studies.

MySQL Remote Configuration

 
 
  1. GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'your paaaword'; 

% Indicates that many machines exist.

Open Port 3306, set exceptions for the firewall, and release port 3306.

The following are online selections

1. ALTER TABLE

It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log on to the computer of localhost. After logging on to MySQL, change the "host" item in the "user" table in the "MySQL" database to "%" from "localhost"

 
 
  1. MySQL -u root -pvmwareMySQL>use MySQL;  
  2. MySQL>update user set host = ‘%’ where user = ‘root’;  
  3. MySQL>select host, user from user; 

2. Authorization Law

For example, if you want myuser to use mypassword to connect to the MySQL server from any host.

 
 
  1. GRANT ALL PRIVILEGES ON *.* TO myuser@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;  
  2. FLUSH PRIVILEGES; 

If you want to allow myuser to connect to the MySQL server from a host whose ip address is 192.168.1.6, and use mypassword as the password

 
 
  1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;   
  2. FLUSH PRIVILEGES; 

I used the first method. I first found that it could not work. I checked it online and executed one less statement MySQL> FLUSH PRIVILEGES.
Make the modification take effect.

Enable the remote connection permission for the MySQL database:

 
 
  1. grant all privileges on *.* to 'root' @'%' identified by 'wrx123';  
  2. flush privileges; 

When you enable MySQL remote connection, change your HOST field to %, indicating that any address can be logged on with this account, or you can set an IP address.

 
 
  1. MySQL>GRANT ALL on *.* to 123@192.168.0.% identified by “456″; 

Note: The firewall of the MySQL host is faulty. Port 3306.

Reference http://hi.baidu.com/zham/blog/item/3a6a8018c0d283b34bedbc40.html

Original article title: MySQL remote connection Configuration

Connection: http://www.cnblogs.com/qqian/archive/2010/03/05/1679119.html

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.