MySQL Database remote Connection open method

Source: Internet
Author: User

Sometimes need to remotely connect MySQL database, the default is not possible, you can refer to the following method to resolve the next.

1. Log in to your own machine MySQL database: mysql-uroot-p password

Set root user can access any IP, the code is as follows (optional, here% is arbitrary, can also specify IP):

Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;


2, Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;

Permission to access data to any host

3, Mysql>flush privileges;

Changes take effect

4, Mysql>exit

Log out of MySQL server

This will allow you to log in as root on any other host!

Enter IP and ports on other machines (port default 3306), pro-Test OK

c:\users\xxxxx>mysql-uroot-proot-h192.168.0.3-p3307
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 936
Server version:5.5.28 MySQL Community Server (GPL)

Copyright (c), the Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

MySQL Database remote Connection open method

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.