> For the complete documentation index, see [llms.txt](https://1938494248.gitbook.io/shu-ju-ku/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://1938494248.gitbook.io/shu-ju-ku/master.md).

# docker安装MySql5.x

## 使用Docker创建MySql数据库

#### 一、创建Mysql容器

```
docker run -it -d --name lyh-mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 mysql:latest
```

#### 二、此时创建好的容器使用远程连接数据库会报以下错误

ERROR 2059 （HY00）: Authentication plugin ……

#### 三、错误原因

这个是由于MySql8.0之后的加密规则为caching\_sha2\_password 而之前版本的加密规则为mysql\_native\_password

#### 四、解决错误

```
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
```

> 将加密方式改为mysql\_native\_password
