2019年2月

mysql 8.0以上更换认证方式,第三方客户端连接会出现

caching-sha2-password 问题

处理办法

切换到mysql->user 表
alter user 'root'@'localhost' identified by 'password' password expire never; //修改加密规则
alert user 'root'@'localhost' identified with mysql_native_password by 'password';  //更新用户密码
flush privileges;  //刷新权限
alter user 'root'@'localhost' identified by '新密码' //重置密码

创建新用户并赋予远程访问权限

8.0以下
create user '用户名'@'localhost' identified by '密码'; //创建新用户
create database 数据库名字  //创建新数据库
1.grant all privileges on 数据库.* to '用户名'@'%' identified by '密码' with grant option;
8.0及以上
1.CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';
2.GRANT ALL ON *.* TO 'root'@'%';
3.ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
flush privileges;  //刷新权限

修改sql_mode模式,5.7以上

select @@GLOBAL.sql_mode  //查看当前模式
set @@GLOBAL.sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'

mysql.sock丢失

mysql --protocol=TCP -uroot -p123456 -hlocalhost