# ubuntu 首次安装mysql修改密码



找到安装时默认生成的默认账户在终端上输入 sudo cat /etc/mysql/debian.cnf 如下图显示的账号和密码

```bash
# sudo cat /etc/mysql/debian.cnf

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