MySQL add remote user or allow remote access three methods

Source: Internet
Author: User
Tags mysql tutorial

Method One
Add remote user admin password to password
GRANT all privileges on * * to[email protected]identified by \ ' password\ ' with GRANT OPTION;
GRANT all privileges on * * to[email protected]\"%\" identified by \ ' password\ ' with GRANT OPTION;
MySQL tutorial add remote user or allow remote access three ways
Log in with the root user and then:
Grant all privileges the user name created by * to ("%" identified by "password";
Flush privileges; * Refresh the contents of just now *
Format: Grant permissions on the database tutorial name. table name to user @ Login host identified by "User password";
After the @ is the client IP address (or hostname) that accesses MySQL is represented by any client, if you fill out localhost as
Local access (the MySQL database cannot be accessed remotely by this user).
You can also set whether you have remote access permissions for existing users. As follows:
Use MySQL;
Update db Set host = '% ' where user = ' user name '; (If written as host=localhost, this user does not have remote access permission)
Flush privileges;
Grant all privileges on * * to ' myuser ' @ ' percent ' identified by ' mypassword ' with GRANT option;

Method two
1.   Add using the GRANT statement: first log on to MySQL with the root user
on the database computer (I am using remote control of the Linux server, equivalent to logging on to MySQL on the server), and then enter:
Mysql>grant all Privileges on * * to [email  Protected] identified by ' something ' with GRANT option;
Add a user admin and authorize access via local machine (localhost), password "something".
 mysql>grant All privileges on * * to [email  protected] "%" identified by ' something ' with GRANT option;
Add a user admin and authorize access that can originate from any other host (wildcard%). You can use this statement.
2. Use the INSERT statement:
Mysql>insert into user values ('% ', ' admin ', password (' something '), ' y ', ' y ', ' y ', ' y ', ' y ', ' y ',
' y ' , ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ')
   user information can be viewed in the users table in the MySQL database, which is not described here. Count the number of Y oh.
   OK, use the Admin account connection try, I was repeatedly successful Oh, hehe!

Method Three
Add remote user admin password to password
Grant all privileges on * * to [email protected] identified by ' Password ' with GRANT option;
Grant all privileges on * * to [E- Mail protected]"%" identified by ' Password ' with GRANT option;

Because of the requirements of the project development database design has to use remote mode. But the remote setting of the database is not so simple, the project's database is mysql5.0. Just started to think that as long as the database server can be remote link, but the MySQL settings for the user's security, the system default setting is not allow remote users to connect, only local users connect. As long as we set the system administrator user's host this item value can be given to the remote user access.

MySQL add remote user or allow remote access three methods

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.