First, install
sudo apt-get update sudo apt install mysql-server
Second, change your password
1, due to the installation process does not prompt for a password, and use the command sudo mysql_secure_installation process has been an error: Error: Access denied for user 'root' @ 'localhost' (using password: YES)
Solution:
1, go to the next etc / mysql directory, view debian.cnf file:
sudo cat debian.cnf
2, view the MySql user name, password, and log:
Username: debian-sys-maint
Password: bgZ3yhfFiou0mfGY
Login: mysql -udebian-sys-maint -pbgZ3yhfFiou0mfGY
3, modify the user name and password
show databases;
use mysql;
the User Update the SET authentication_string = PASSWORD ( " your password " ) the WHERE the User = ' root ' ;
update user set plugin="mysql_native_password";
flush privileges;
quit;
4, restart the MySql
/etc/init.d/mysql restart