1. 程式人生 > >MySQL開啟遠端訪問許可權

MySQL開啟遠端訪問許可權

1、第一步登入資料庫

[[email protected] ~]# mysql -uroot -p
2、進到mysql庫

MariaDB [(none)]> use mysql;

3、檢視許可權情況

MariaDB [mysql]> select host,user,password from user;

4、基於使用者

MariaDB [mysql]> grant all privileges on *.* to [email protected]'%'identified by '123456';

MariaDB [mysql]> flush privileges;

5、基於IP

MariaDB [mysql]> grant all privileges on *.* to 'root'@'192.168.0.4'identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;