mysql数据库的创建和字符集的指定
# utf8 字符集
create database `dbname` default character set utf8 collate utf8_general_ci;
# utf8mb4 字符集
create database `dbname` default character set utf8mb4 collate utf8mb4_unicode_ci;
mysql数据库的授权,mysql5.x 版本授权方式
# 授权所有权限访问
grant all privileges on dbname.* to user@'%' identified by 'password';
# 授权只读权限访问
grant select on dbname.* to user@'%' identified by 'password';
# 授权增删改查权限访问
grant select,update,insert,delete on dbname.* to user@'%' identified by 'password';
# 刷新权限
flush privileges;
mysql数据库的授权,mysql8 版本授权方式
# 先创建用户
create user 'user'@'%' identified by 'password';
# 创建可以使用Navicat连接的加密认证规则用户
create user 'user'@'%' identified with mysql_native_password by 'password';
# 然后再授权
grant all privileges on dbname.* to 'user'@'%' with grant option;
# 刷新权限
flush privileges;
# 修改已有用户加密认证规则
alter user 'user'@'%' identified with mysql_native_password BY 'password';
本文最后记录时间 2024-03-30
文章链接地址:https://wojc.cn/archives/797.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处
文章链接地址:https://wojc.cn/archives/797.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处