1. 登录群辉 SSH
2. 执行命令查看MariaDB 安装位置
ps -ef | grep mysql
3. 找到mysql 路劲 进入目录
cd /usr/local/mariadb10/bin/
4. 进入mysql
./mysql -uroot -p
5. 修改数据库
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
报错执行这句
MariaDB [(none)]> grant all privileges on *.* to 'root'@'10.3.12.50' identified by 'root' with grant option;
提示有错误,直接查看修改结果:
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 root@'%'=password('123456');
Query OK, 0 rows affected (0.001 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
退出登录,远程连接验证