1、登录宝塔面板进行安装
2、设置MySQL连接密码
3、安装好了设置navicat连接
登录MySQL
[root@hecs-394544 ~]# mysql -uroot -p
Enter password:
切换到MySQL数据
mysql> use mysql
Database changed
mysql>
查询用户信息
mysql> select host,user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| 127.0.0.1 | test1 |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | test1 |
+-----------+------------------+
6 rows in set (0.00 sec)
mysql>
第一行host是我自己添加的,最下面一行是一开始就有的root账户,可以直接把user表的root账户对应的host改为’%'就可以在Navicat上远程登录了,就是SQL的update语句,不用搞得那么复杂
update user set host = '%' where host = 'localhost' and user = 'root';
mysql> update user set host = '%' where host = 'localhost' and user = 'root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> select host,user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| 127.0.0.1 | test1 |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | test1 |
+-----------+------------------+
6 rows in set (0.00 sec)
mysql>
刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
设置navicat连接文章来源:https://www.toymoban.com/news/detail-827086.html
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; ### 123456 mysql的登录密码
Query OK, 0 rows affected (0.00 sec)
mysql>
刷新权限文章来源地址https://www.toymoban.com/news/detail-827086.html
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
到了这里,关于宝塔安装MySQL、设置MySQL密码、设置navicat连接的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!