grant remote access of MySQL database from any IP address

后端 未结 21 1292
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 09:18

I am aware of this command:

GRANT ALL PRIVILEGES
ON database.*
TO \'user\'@\'yourremotehost\'
IDENTIFIED BY \'newpassword\';

But then it on

21条回答
  •  渐次进展
    2020-11-22 09:40

    For anyone who fumbled with this, here is how I got to grant the privileges, hope it helps someone

    GRANT ALL ON yourdatabasename.* TO root@'%' IDENTIFIED BY
    'yourRootPassword';
    

    As noted % is a wildcard and this will allow any IP address to connect to your database. The assumption I make here is when you connect you'll have a user named root (which is the default though). Feed in the root password and you are good to go. Note that I have no single quotes (') around the user root.

提交回复
热议问题