Configure remote access for mysql

Source: Internet
Author: User

Configure remote access for mysql

By default, mysql cannot be called remotely. In the project development process, this situation cannot be avoided.

Install mysql. This installation-free version has been introduced in the relevant blog.

See:MysqlInstallation configuration and common operations without installation.

Installation download: http://dev.mysql.com/downloads/mysql/

Whether the database is installed or not, mysql will bring a database named mysql. The user table is maintained by the mysql database, so our operation is actually the access permission for this user. The problem is clear. If the access fails,

First case: the user table does not have this user, that is, the user field of the user table does not have this user

Case 2: The user exists in the user table, and the user has no permission to access other tables, the permissions are also maintained by the mysql user, db, host, table_priv, and columns_priv tables.

The problem is clear, followed by specific solutions to the problem

Solution 1:

After Login

Mysql> use mysql

Check whether the user and password exist in the user table.

Mysql> select host, user, password from user;

Set root unlimited access to remote calls for mysql

Update user set host = '%' where user = 'root ';

Grant all privileges on *. * to root @ '%' identified by "root ";

 

Solution 2: create a user and authorize the user

// Create a user with the specified password and host

Create user 'username' @ 'host' identified by 'Password ';

Host: Address of the mysql server to be accessed/username: username password: password

Grant all privileges on user. * TO "username" @ "IP" identified by "123456"

Username indicates the login user name, and IP indicates the server address for remote login to mysql.

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.