通过远程连接Linux版的MySQL

1、遇到无法连接,如图所示:

 

分析原因:

a、执行命令:show databases;

             use mysql;

 b、接着把数据库的表显示出来:show tables;

 

C、我们系统数据库

Mysql下的表,查询表user,如果,执行命令:select * from user;

会出现乱码,如图所示:

 

 我们可以这样执行:select * from userG; 如图所示:

 

 D、这时,我们需要插入一条语句:select host,user,password from user;

如果突然报错:ERROR 1054 (42S22): Unknown column 'password' in 'field list'

如图所示:

 

解决问题:

(1)查看mysql中表user的结构,直接describe user

 

 

 password替换成authentication_string

 E、直接执行:select host,user,authentication_string from user;

 

 F、执行权限命令:grant all privileges on *.* to root@'%' identified by 'root';

 

 

 g、再次查看权限信息,直接执行:select host,user,authentication_string from user;

 

 

 多了一个%号

 我们在上图中,如果能看到%,就可以只用客户端连接的,

刚开始远程工具无法连接上,

 

 

远程连接linux下的mysql Err1045 Err2003解决办法:

关闭防火墙:systemctl stop firewalld.service

 

 

 再次使用远程工具连接,就可连接上!

熬夜,整理完,问题解决!

原文地址:https://www.cnblogs.com/studygithub5208868/p/11503993.html