1.连接MySQL
# mysql -uroot -proot
2.登录mysql数据库
MariaDB [(none)]> use mysql;
3.更改远程连接设置
MariaDB [mysql]>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234567' WITH GRANT OPTION;
例如:指定访问demo数据库
MariaDB [mysql]>GRANT ALL PRIVILEGES ON demo.* TO 'root'@'%' IDENTIFIED BY '1234567' WITH GRANT OPTION;
4.生效修改的权限
MariaDB [mysql]> flush privileges;
5.查看修改结果
MariaDB [mysql]> select host,user from user;