mysql建库和新建用户、授权:
CREATE DATABASE java; --建库
CREATE USER 'javauser'@'10.%' identified by 'java123456'; --新建用户
flush privileges; --提交
grant all privileges on java.* to 'javauser'@'172.16.%' with grant option; --授权
flush privileges; --提交
ALTER USER 'javauser'@'172.16.%' IDENTIFIED WITH mysql_native_password BY 'java123456'; --报错 2058 解决;
flush privileges; --提交
SELECT * FROM mysql.user -- 查找用户
-- Delete FROM mysql.user Where User='javauser' and Host='%'; -- 删除用户
-- drop user 'javauser'@'172.16.%';-- 删除用户
SQLyog 报错2058 :连接 mysql 8 解决方法,执行:
ALTER USER 'javauser'@'172.16.%' IDENTIFIED WITH mysql_native_password BY 'java123456';
flush privileges; --提交
mysql8碰到ERROR 1396 (HY000)的解决方案:
CREATE USER ‘javauser’@‘172.16.%’ identified by ‘java123456’; --新建用户
执行报错
1396
Operation CREATE USER failed for ‘javauser’@‘172.16.%’
这个报错是新建用户失败,解决方案如下:
-- 1、提交修改
flush privileges; --提交
-- 2、删除用户并提交
drop user javauser@'172.16.%' ;
flush privileges; --提交
-- 3、重新新建用户
CREATE USER 'javauser'@'172.16.%' identified by 'java123456'; --新建用户