Add remote users to MYSQL or allow remote access

Source: Internet
Author: User
Tags mysql tutorial

Add the remote user admin password as password grant all privileges on *. * TO admin @ localhost identified by \ 'password \ 'with grant option grant all privileges on *. * TO admin @ \ "% \" identified by \ 'password \ 'WITH GRANT OPTION

Add a remote user or allow remote access in the mysql tutorial

Log On with the root user, and then:

Grant all privileges on *. * to create the username @ "%" identified by "password ";

Flush privileges; * refresh the content just now *

Format: grant permission on Database tutorial name. Table name to user @ login host identified by "User Password ";

@ Followed by the IP address (or host name) % of the client accessing mysql represents any client. If you enter localhost

Local access (this user cannot remotely access the mysql database ).

You can also set the remote access permission for existing users. As follows:

Use mysql;

Update db set host = '%' where user = 'username'; (if the name is host = localhost, this user does not have the remote access permission)

Flush privileges;

Grant all privileges on *. * to 'myuser' @ '%' identified by 'mypassword' with grant option;

 

 

Method 2

1. Add using the grant statement: first, use the root user on the local database.

Log on to mysql (I remotely control the linux server, which is equivalent to logging on to mysql on the server) and enter:

Mysql> grant all privileges on *. * to admin @ localhost identified by 'something' with grant option;

Add a user admin and authorize access through localhost with the password "something ".

Mysql> grant all privileges on *. * to admin @ "%" identified by 'something' with grant option;

Add a user admin and authorize access initiated from any other host (wildcard % ). Use this statement.

2. Use the insert statement:

Mysql> insert into user values ('%', 'admin', password ('something'), 'y ', 'y', 'y ',

'Y', 'y ')

User information can be viewed in the users table of the mysql database. Count the number of y.

Okay. Try using the admin account. I have tried and tried multiple times successfully!

Method 3

Add the remote user admin password as password
Grant all privileges on *. * to admin @ localhost identified by 'Password' with grant option
Grant all privileges on *. * to admin @ "%" identified by 'Password' with grant option


Because of the requirements of project development, the database design has to use the remote mode. However, the remote settings of the database are not that simple. The database of this project is mysql5.0. At the beginning, I thought that a remote connection can be performed as long as the database server is installed. However, mysql is set for user security. The default system setting is that remote user connection is not allowed, only Local Users can be connected. You only need to set the host value of the system administrator user to allow remote access.

 

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.