WLCYSYS

 

 

  前言:

  一:配置

  ubuntu 18.04 

  mysql 5.7.30

  二:问题 

  ubuntu18.04下mysql安装时没有出现密码提示,安装后自己有一个默认的用户名以及密码

   解决方案:

  1. 在终端输入:

 

sudo vi /etc/mysql/debian.cnf

 


可以查看到:

user     = debian-sys-maint


password = WU2UbLLd4totyAs8

 

 

 

 

 

 

 

  2. 用该账户登陆mysql:

  注意:这里的密码是上面的{随机密码}

mysql -u debian-sys-maint -p

 

 

 

  3. 设置root的用户密码:

 

update mysql.user set authentication_string=password('123456') where user ='root' and Host='localhost';
update mysql.user set plugin = 'mysql_native_password';
flush privileges;
quit

 

 

 

 

  4. 重启mysql服务:

 

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

 

  5. 用root登陆:

 

mysql -u root -p

 

 

 

 


————————————————

参考链接:https://blog.csdn.net/Kwoky/article/details/89492074

     

分类:

技术点:

相关文章:

  • 2021-04-22
  • 2021-12-29
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-03-30
  • 2021-07-30
猜你喜欢
  • 2021-11-16
  • 2021-11-07
  • 2022-12-23
  • 2021-12-03
  • 2021-04-14
  • 2021-12-01
相关资源
相似解决方案