系统:centos 7.2
mysql版本:mysql 5.7
平台:腾讯云


安装MySQL时,没有让我输入密码,所以安装完后,需要自己找。

密码在mysqld.log 文件中
输入命令find / -name mysqld.log查找其位置

在xshell 6中,ctrl+shift+F可以查找字段password
使用cat命令查看文件
MySQL查看默认密码和修改密码

查找到默认密码之后,就可以用
mysql -u root -p
进入mysql,然后输入密码


修改密码:

使用命令
update mysql.user set authentication_string=password('*******') where user='root';
参考 https://www.cnblogs.com/wangbaobao/p/7087032.html

很多教程里提到的
update user set password=password(“新密码”) where user=”用户名”; 在当前mysql版本会出错。

相关文章:

  • 2021-07-25
  • 2022-12-23
  • 2021-11-28
  • 2021-12-05
  • 2021-05-07
  • 2021-09-30
  • 2021-10-26
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2022-02-12
  • 2021-12-12
  • 2021-11-02
  • 2021-12-05
  • 2021-09-03
相关资源
相似解决方案