简体   繁体   中英

Connect to a MySQL server on another server

I have a website hosted by namecheap and trying to move it to AWS. For now, I want to keep using the MySQL server on namecheap. I searched online for solutions and one was to whitelist the AWS ip address in the cpanel. That option doesn't exist in my cpanel.

Any suggestions?

You have to make a user with AWS ip address.

  1. Allow specific IP

    mysql> grant all privileges on *.* to 'user'@'12.34.56.78' identified by 'user's password';

  2. Allow IP with wildcard (12.34.0.0/16)

    mysql> grant all privileges on *.* to 'user'@'12.34.%' identified by 'user's password';

  3. Allow all IP

    mysql> grant all privileges on *.* to 'user'@'%' identified by 'user's password'

Applying changes

mysql> flush privileges;

You have to modify mf.cnf to listen port comment

#bind-address = 127.0.0.1

in my.cnf

then restart your mysql server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM