Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This article is mounted directly solve the Ubuntu command line when installing MySQL, the root password is not initialized question
1. First, enter the following command
sudo cat /etc/mysql/debian.cnf
2. Enter the following commands
mysql -u debian-sys-maint -p
// Note! This instruction password is entered in the password information obtained in the first instruction = ZCt7QB7d8O3rFKQZ come
// please fill out according to their actual situation!
3. To change the password, the password to modify this article to root, user definable
1. use mysql; 2.//下面这句命令有点长,务必注意 update mysql.user set 3.authentication_string=password('root') where user='root' and Host 4.='localhost'; update user set plugin="mysql_native_password"; flush privileges;
4. Restart mysql:
Service restart MySQL 1.sudo
2.mysql -u root -p
After starting the input 3.// have modified a good password: root