0%

MySQL创建后的基本操作

MySQL新启动之后的基本操作

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mysql -uroot -p 

>mysql use mysql;
>mysql select host, user, pulgin from user;
# 授权root用户获得所有权限
>mysql grant all on *.* to 'root'@'%'; flush privileges;
# 设置客户端使用password可登录
>mysql alter user 'root'%'%' identified with mysql_native_password by '{your_password}'; flush privileges;
# 创建B数据库(schema)
>mysql create schema B default character set utf8mb4 collate utf8mb4_general_ci;
# 创建A用户
>mysql create user 'A'%'%' identified by '{B_password}';
# 授权A用户获得B库的所有权限
>mysql grant all on B.* to 'A'%'%'; flush privileges;