grant remote access of MySQL database from any IP address

后端 未结 21 1270
伪装坚强ぢ
伪装坚强ぢ 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:23

    Open your mysql console and execute the following command (enter your database name,username and password):

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

    Then Execute:

    FLUSH PRIVILEGES;

    Open command line and open the file /etc/mysql/mysql.conf.d/mysqld.cnf using any editor with root privileges.

    For example:

    sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
    

    Then comment out the below line:

    bind-address = 127.0.0.1

    Restart mysql to reflect the changes using command:

    sudo service mysql restart
    

    Enjoy ;)

提交回复
热议问题