How to enable MySQL database remote connection _ MySQL

Source: Internet
Author: User
MySQL database remote connection enabling method bitsCN.com Method 1: more detailed
The following articles mainly introduce the operation process of enabling remote connection for MySQL database. In fact, it is not difficult to start the actual operation steps of remote connection for MySQL database, today, we want to describe the process of starting a remote connection to the MySQL database.

1. d:/MySQL/bin/> MySQL-h localhost-u root

In this way, you can access the MySQL server.

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

Grant data access permissions to any host

3. MySQL> FLUSH PRIVILEGES

Modification takes effect

4. MySQL> EXIT

Log out of the MySQL server

In this way, you can log on to any other host as the root user!

The above content is an introduction to enabling remote connection to the MySQL database. I hope you will get some benefits.

Method 2:
1. run mysql-u root-p mysql on the console. the system prompts you to enter the password of the root user of the database. after the password is entered, the mysql console is displayed. The first mysql command of this command is to execute the command, the second mysql is the system data name, which is different.

2. ON the mysql console, run grant all privileges on *. * TO 'root' @ '%' identified by 'mypassword' with grant option;

3. run the 'root' @ '%' command on the mysql console to understand that "root" is the user name and "%" is the host name or IP address. "%" here represents any host or IP address, you can also replace it with any other user name or specify a unique IP address. 'mypassword' is the password for authorized users to log on to the database; in addition, it should be noted that I here are to authorize all permissions, you can specify part of the permissions, GRANT specific operation details see: http://dev.mysql.com/doc/refman/5.1/en/grant.html

4. if you are not at ease, you can execute select host and user from user on the mysql console; check the content in the user table bitsCN.com

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.