mysql 设置root密码

新安装的MySQ安装的时候并没有提示设置密码,通过免密码的方式登录,如果你想设置密码:

  1、在MySQL5.7之前输入update user set authentication_string=password("XXXXXX") where user='root' and host='localhost';

  2、MySQL5.7之后mysql数据库下已经没有password这个字段了,需要改成authentication_string,update user set authentication_string=password("XXXXXX") where user='root' and host='localhost';

猜你喜欢

转载自www.cnblogs.com/zhheng/p/10141281.html