Files
Knowledge/1 使用/数据库/docker mysql.md
T

47 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## start.sh 注意事项
You need to specify one of the following as an environment variable: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD
## DBear 连接 Mysql
1. 右键数据库连接 → **编辑连接**。
2. 切换到 **驱动属性** 标签页。
3. 找到或添加以下两个属性:
- `allowPublicKeyRetrieval` = `true`
- `useSSL` = `false`(如果不需要加密,设置为 `false` 可以绕过 SSL 要求)
## 数据库内部维护
进入容器
```
docker exec -it mysql bash
```
使用 root 登录
```
mysql -u root -p
```
查看登录模式
```
SELECT User, Host, plugin FROM mysql.user WHERE User = 'root';
```
## Mysql 区分大小写
```
SELECT @@lower_case_table_names;
```
|返回值|含义|大小写行为|
|---|---|---|
|**0**|大小写**敏感**(Linux 默认)|`MyTable` ≠ `mytable`|
|**1**|**忽略大小写**,MySQL 自动将名称转为小写存储|`MyTable` = `mytable`|
|**2**|按原样存储,比较时忽略大小写(macOS 默认)|`MyTable` 存储原样,比较时忽略|