WARING:
最近8.0的mysql出来了,又出现各种错误
ALTER USER ‘root'@‘localhost' IDENTIFIED WITH mysql_native_password BY ‘111111';
flush privileges
现在使用这两句修改密码
WARNING:
1.改完cnf记得重启
2.下面的代码记得手打,不能复制、不能复制、不能复制,复制会出错。
1.user表设置密码
5.7还是那个版本之后就不存在password这个字段了,需要使用authentication_string来修改密码,以及设置plugin
update user set authentication_string=PASSWORD("") where User=‘root’;update user set plugin=“mysql_native_password” where User=‘root’;
2.password(“”)
使用这个的时候,不知道是什么原因总是报错,后换为大写,就可以使用了,记录一下算了。
3.%
修改mysql外部可访问的时候的坑,root修改后就可以了,如果是其他用户
create user test identified by '123456';
grant all privileges on *.* to 'test'@'%'identified by '123456' with grant option;
flush privileges ;
再然后将服务器配置文件中的-bind注释掉就可以了,还要讲Host字段设置为%。
重置密码:在[mysqld]下面添加 skip-grant-tables,然后service restart 就可以了