1、第一步登录数据库
[root@instance-u5vpjp1n ~]# 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 root@'%'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;

本文详细介绍了如何通过五步操作实现远程登录并管理MySQL数据库,包括登录数据库、进入mysql库、查看权限、基于用户和IP授予全部权限及刷新权限。
745

被折叠的 条评论
为什么被折叠?



