Configure remote connection MySQL database connect to remote MySQL db

Source: Internet
Author: User

With local machine, IP address is localip remote machine, IP address remoteip to connect the MySQL database of remote machines through the terminal of local machines. and manipulate the database. 1. Install MySQL in both local and remote, and install the method refer to another blog. 2. Connect to remote host$ ssh in local ssh [email protected]3. Open the remote host for MySQL and add users to local. $ mysql-uroot-pmysql>grant All on * * to [email protected] ' localip ' identified by ' my_password ';//The GRANT statement above means Create a MySQL user mysqluser on Localip, and give the user all the permissions for all of this MySQL database. 4. View the results of Step 3 mysql>select Host, User, Password from Mysql.user;5. After completing the four steps above, the local connection to the remote MySQL generally fails, at this time for a variety of reasons, you can refer to the following links in the method. <a Target=_blank href= "http://www.cyberciti.biz/tips/ How-do-i-enable-remote-access-to-mysql-database-server.html ">http://www.cyberciti.biz/tips/ How-do-i-enable-remote-access-to-mysql-database-server.html</a> own case is the link in the step # 7:open Port 3306. Enter quit after step 4 to quit MySQL, but at this point the terminal's host is still remote host. Execute, $ sudo/sbin/iptables-a input-i eth0-p tcp--destination-port 3306-j accept$ sudo service iptables save6. Enter a command to exit the remote Host, test whether you can connect to a remote mysql$ exit$ nc-z-w1 65.55.55.2 3306 If shown: Connection to <remoteip> Port 3306 [Tcp/mysql] succeeded! is successful. You can use the MySQL command to connect to remote MySQL. $ mysql-u mysqluser-h remoteip-p

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Configure remote connection MySQL database connect to remote MySQL db

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.