MySQL 默认有几个库?

1
2
3
4
5
|--库名--|--作用--|
mysql​ ✅ | 核心系统库(用户、权限、密码策略等)|
information_schema​ | 元数据(表结构、字段、索引等信息)|
performance_schema​ | 性能监控|
sys​ | 基于 performance_schema 的易读视图|

MySQL 操作常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
show databases;
# 显示所有数据库

use mysql;
# 切换到系统库
use go_zhuce

select user,host,plugin from user where user='go_user';
# 查询go_user用户的插件信息,也就是密码认证的方式,就是plugin字段


ALTER USER 'go_user'@'localhost' IDENTIFIED WITH mysql_native_password BY '自定义密码';

# 修改go_user用户的认证方式,同时修改密码,因为旧的系统不支持最新的认证方式
# 新的认证方式是caching_sha2_password

FLUSH PRIVILEGES;
# 刷新权限,使修改生效

show tables;
# 显示所有表

desc bulletins;
# 显示bulletins表的所有字段
select * from bulletins;
# 查询bulletins表的所有数据 ,包括所有字段

DELETE FROM bulletins WHERE id = 2;
# 删除id为2的记录