MySQL Remote connection authorized IP

Source: Internet
Author: User

New Method
    • We now add a ' username ' user with a password of ' password ', allowing it to access MySQL from outside.
1 Grant all on * to ' username ' identified by ' password ';
    • To view the user table content, enter select User,host from user, you can see that the "username" user has been added, and its permissions are '% '.
    • We can now use Username users to access IP in the LAN or the Internet.
MySQL -H IP address-u username-PFLUSH Privileges
Change Table Method
    • If your account is not allowed to log on remotely, log in to MySQL that requires remote access to the computer where the database resides.
    • Change the ' host ' entry in ' MySQL ' database from ' localhost ' to '% '
1 MySQL -u root-p2mysql> Usemysql; 3 MySQL>update user set host = '% ' where user = ' root '; 4 MySQL>select host, user from user;
Authorization Law
    • Require user ' username ', use password ' password ' to connect to MySQL server from any host
1 GRANT all privileges on * * to ' username ' @ ' percent ' identified by ' password ' with GRANT OPTION; 2 FLUSH privileges;

    • Require only IP for 192.168.0.1 to use username ' username ', password ' password ' to connect to MYSQ
1 GRANT all privileges on * * to ' username ' @ ' 192.168.0.1 ' identified by ' password ' with GRANT OPTION; 2 FLUSH privileges;

    • Require only allow IP for 192.168.0.1 use username ' username ', password ' password ' to connect to the dbname database of the MySQL server
1 GRANT all privileges on dbname.* to ' username ' @ ' 192.168.0.1 ' identified by ' password ' with GRANT option;2FLUSH privileges;

MySQL Remote connection authorized IP

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.