Mysql数据库的创建和授权
· 技术积累 · Linux Mysql

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://me.jinchuang.org/archives/797.html
本站文章除注明[转载|引用],均为本站原创内容,转载前请注明出处
统计文本中每个字符出现的次数
Nali 离线ip数据库文件
苹果CMS v10内容管理系统搭建
SQLSTATE[HY000]: General error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'like'

九种色彩折纸风格-鼠标指针

CSS3/jQuery实现移动端滑动图片层叠效果

我要留言