Commit f50577
2025-11-27 08:34:57 Terry: update| /dev/null .. it运维/常用mysql操作命令.md | |
| @@ 0,0 1,33 @@ | |
| + | # 常用Mysql操作命令 |
| + | |
| + | --- |
| + | |
| + | 1. 创建用户 |
| + | |
| + | ```bash |
| + | CREATE USER 'admin'@'%' IDENTIFIED BY '9piSt@J8BXoc6'; |
| + | ``` |
| + | |
| + | - 'admin'@'%'为 需要创建的用户名 |
| + | - '9piSt@J8BXoc6' ,''内为设置的密码 |
| + | |
| + | 2. 为用户 获取 数据库权限 |
| + | |
| + | ```bash |
| + | GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%'; |
| + | ``` |
| + | |
| + | - *.为 所有数据库的所有表 |
| + | - admin 为上面创建的用户名 |
| + | |
| + | 3. 刷新权限 |
| + | |
| + | ```bash |
| + | FLUSH PRIVILEGES; |
| + | ``` |
| + | |
| + | 4. 创建数据库 |
| + | |
| + | ```bash |
| + | CREATE DATABASE IF NOT EXISTS `test`; |
| + | ``` |