465 字
2 分钟
mysql基础
mysql基础
graph LR %% 使用 LR 方向,更符合阅读习惯 开始[mysql基础]
subgraph SG_A [数据库与服务] direction LR a[mysql数据库] a --> a1[包:mysql-server] a --> a2[服务:mysqld] a --> a3[端口:3306] a --> a4[端口:33060] end
subgraph SG_B [常用命令] direction LR b[mysql必备命令] b --> b1[select version() 查询版本] b --> b2[select user() 查询登录用户] b --> b3[select database() 查询使用的使用的数据库] b --> b4[use database名字:使用数据库] b --> b5[show databases 显示所有的数据库] b --> b6[show talbes 显示当前库下面的所有表] b --> b7[desc 表名:查看表结构] end
subgraph SG_C [安全与管理] direction LR c[密码管理] c --> c1[mysql 连接数据库服务 ] c --> c2[mysql -u root -p密码 ] c --> c3[mysqladmin -u root password 密码] c --> c4[忘记密码 ] end
subgraph SG_D [查询操作] direction LR d[条件查询] d --> d1[= 等值查询] d --> d2[!= 不等值查询] d --> d3[> ,< , >=, <=,] d --> d4[between x and y 范围查询] d --> d5[like 模糊查询] d --> d6[逻辑查查(and , or)] d --> d7[为空:字符串空,真空(is null is not null)] d --> d8[别名,合并,去重] end
subgraph SG_C_a [忘记密码] direction LR c_a[忘记密码] c_a --> c_a1[ 1. 修改mysql配置文件 vim /etc/my.cnf.d/mysql-server.cnf skip-grant-tables 不需要密码验证 ] c_a --> c_a2[ 2. 重启mysql服务 systemctl restart mysqld ] c_a --> c_a3[ 3. 无密码登录 mysql ] c_a --> c_a4[ 4. 把密码修改为空 update user set authentication_string='' where user='root'; ] c_a --> c_a5[ 5 修改mysql配置文件 vim /etc/my.cnf.d/mysql-server.cnf 去掉skip-grant-tables ] c_a --> c_a6[ 6.重启mysql服务 systemctl restart mysqld ] c_a --> c_a7[ 7.无密码登录 mysql ] c_a --> c_a8[ 8. 在mysql终端里面设置密码 alter user root@'localhost' identified by 'NSD123456...a' ] end %% 重新规划连接线 开始 --> SG_A 开始 --> SG_B 开始 --> SG_C 开始 --> SG_D c4 --> SG_C_a
linkStyle 0,1,2,3,4 stroke:gray;