1. 登录群辉 SSH
2. 执行命令查看MariaDB 安装位置
ps -ef | grep mysql
3. 找到mysql 路劲 进入目录
cd /usr/local/mariadb10/bin/
4. 进入mysql
./mysql -uroot -p
5. 修改数据库
update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
提示有错误,直接查看修改结果:
MariaDB [mysql]> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
+-----------+------+
3 rows in set (0.001 sec)
证明修改成功了。
再次修改数据库密码以防止无法登陆问题 (ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
)
MariaDB [mysql]> set password for [email protected]'%'=password('123456');
Query OK, 0 rows affected (0.001 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
退出登录,远程连接验证
原文地址:https://www.cnblogs.com/baily/p/11845446.html
时间: 2024-10-14 05:52:25