Ubuntu18.04 install Mysql reset the root password

After Ubuntu18.04 version can not be used to install mysql is not prompted to enter a password and other operations, so that the installation was successful root login

sudo apt-get install mysql-server  # 安装mysql

First, we need to find the default account

sudo cat /etc/mysql/debian.cnf

Here Insert Picture Description
Log in using the default account (the account password is the last step acquisition), reset the root account (execute the following statement) to

use mysql;  
update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';    #修改密码123456是密码
update user set  plugin="mysql_native_password";
flush privileges;
quit;

Here Insert Picture Description

Published 77 original articles · won praise 19 · views 20000 +

Guess you like

Origin blog.csdn.net/baidu_36943075/article/details/103265261