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';

posted @ 2018-12-19 09:24  zhheng  阅读(511)  评论(0)    收藏  举报