mysql权限回收
1、模拟test环境
检查库是否utf8
SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
+--------------------------+-----------------+
| Variable_name | Value |
+--------------------------+-----------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+--------------------------+-----------------+
如果是以下内容需要在/etc/my.cnf
+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| collation_connection | utf8mb4_unicode_ci |
| collation_database | utf8mb4_unicode_ci |
| collation_server | utf8mb4_unicode_ci |
+--------------------------+--------------------+
character_set_server=utf8
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
skip-character-set-client-handshake=true
2、创建库是设置编码(utf8)格式
CREATE DATABASE chao_test
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE dataexa_insight
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
3、创建用户
insert into mysql.user(host,user,password) vlues('192.168.203.66','chao',password('123456'));
4、用户授权
1)grant select, insert on test2.* to 'chao'@'192.168.203.66' identified by '123456';
2)grant select, insert on test2.* to 'chao'@'192.168.203.66' identified by '123456';
3)授权时也可以创建用户
grant select, insert on test2.* to 'chaochao'@'192.168.203.66' identified by '123456';
5、更改密码
update mysql.user set password=password('123') where user='chaochao' and host='192.168.203.66';
flush privileges;
6、删除用户
drop user 'chaochao'@'192.168.203.66';
flush privileges;
7、drop 表 和 库
8、回收权限