Navicat远程链接mysql-8数据库具体操作

未经允许不得转载

*一:本地链接*

*二:公有云链接*

*备注:此文档是以root用户演示。项目最好用其他用户*

*具体步骤:*

*公有云链接*

*1.登录mysql数据库* *mysql -uroot -pXXX*

创建普通用户并授权

img

*2. 查看*

执行:show databases;

   use mysql

   SELECT Host, User, plugin from user

*3.修改root或者普通用户的加密方式*

 执行修改命令根据你需要访问的host进行修改 (当前模拟是更改了所有加密)

ALTER USER 'root'@'localhost' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'192.168.0.0' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'192.168.0.0' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'%' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

如图:

img

*4.打通隧道(检查是否链接成功--公网默认是8066)*

img

*5.通过远程工具链接*

img

image-20201209143624257

*本地链接*

*1.登录mysql数据库* *mysql -uroot -pXXX*

img

*2.查看*

执行:show databases;

   use mysql

   SELECT Host, User, plugin from user;

*3.修改root或者普通用户的加密方式*

执行修改命令根据你需要访问的host进行修改 (当前模拟是更改了所有加密)

ALTER USER 'root'@'localhost' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'192.168.0.0' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'192.168.0.0' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

ALTER USER 'root'@'%' IDENTIFIED BY 'XXXX' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'XXXX';

FLUSH PRIVILEGES;

image-20201209143335140

*4.打通隧道(本地打通隧道端口可以自定义 只要不冲突就可以)*

img

*5.登录本地安装的mysql客户端验证(客户端根据自己喜好放)*

img

*6.查看本地是否链接成功*

image-20201209143422230

*7.通过远程工具链接*

img

image-20201209143512699

*此模拟公有云 本地都正常链接*

posted @ 2020-12-09 14:40  zhengjia1989  阅读(174)  评论(0编辑  收藏  举报