解决远程连接mysql/mariadb报“allowed to connect to this MariaDB/MySQL server”的方法

允许用户root从ip为192.168.2.2的主机连接到mysql服务器,并使用123456作为密码

MariaDB [(none)]> grant all privileges on *.* to 'root'@'192.168.2.2' identified by '123456' with grant option;    

若是允许所有ip:

GRANT ALL PRIVILEGES ON *.* TO root@'%’ IDENTIFIED BY '123456' WITH GRANT OPTION;

最后执行

MariaDB [(none)]> flush privileges;   //刷新权限缓存  
MariaDB [(none)]> show privileges;  
MariaDB [(none)]> show grants for  'testuser'@'222.129.1.1' 

猜你喜欢

转载自blog.csdn.net/twypx/article/details/81240072