1.安装mariadb并设置开机自启动
[[email protected] ~]# yum install mariadb-server mariadb -y
[[email protected] ~]# systemctl start mariadb.service && systemctl enable mariadb
2.登陆数据库
mysql -u root -p
3.查询user表,发现root默认是localhost,
select user,host from user;
4.更新root权限
MariaDB [mysql]> update user set host ='%' where user = 'root';
再次查看:
5.刷新配置使其生效,命令:flush privileges;
6.完美解决