# 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;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://close.gitbook.io/yun-wei-bi-ji/centos/mysql/ubuntu-shou-ci-an-zhuang-mysql-xiu-gai-mi-ma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
