MYSQL Remote Permissions Control simple configuration

Source: Internet
Author: User
Tags mysql in

Remote Link Database:

Log in to the remote MySQL command:

/*

* Use the root user link 172.20.60.2 port 3306 below the MySQL spectergk database

*/

mysql-h 172.20.60.2-p 3306-u root-p spectergkEnter password to report the following error: Error 1130 (HY000): Host ' 10.18.21.143 ' is not allowed to connect to this MySQL server from error can be seen 10.18.21.43 no permissions Link Database spectergk, so we have to set the MySQL permissions in their own MySQL, the following steps: First login to their own mysql:mysql-u root-p MySQL method One (practice can, project recommended Method II): 1, Production look at the data below your user table: select user,host from user; results:

You can see that root corresponds to the host is 127.0.0.1 this time we can directly modify the 127.0.0.1 to its own IP address

Such as:

Update user Set host = ' 10.18.21.143 ' where user = ' root ';

FLUSH privileges;

See the words below:

So remote can log in but found that they are not logged on, this time we put update user set host = '% ' where user = ' root '; FLUSH privileges;% on behalf of all host can log in, so just do exercise can, project words is impossible. Now MySQL in the sql_mode=no_engine_substitution,strict_trans_tables, so the words are restricted to insert the user inserted, here is not the specific to introduce. Method Two: (Recommended use) we use:
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION; To complete the settings for user permissions on the database
All privileges   are all permissions and can also be insert,select,delete
* * The              database authorized by * * or a table of the database
' MyUser ' @ '% '     username @host   Here the% represents all the host
Identified    by letting the user log in the password
Grant OPTION     Grant these permissions to other users, not necessarily root
Example:
GRANT all privileges the spectergk.* to ' test ' @ ' percent ' identified by ' 111111 ' with GRANT OPTION;
Login with Test Spectergk is granted all permissions.
If you do not have permission in the actual development, you can contact DBA management directly.

MYSQL Remote Permissions Control simple configuration

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.