MySql:基本操作语法

1、Create user from Mysql

//创建lmengi用户
insert into mysql.user(Host,User,Password) values("localhost","lmengi",password("lmengi"));
//赋值所有权限给当前lmengi用户
GRANT ALL PRIVILEGES ON *.* TO 'lmengi'@'localhost' IDENTIFIED BY 'lmengi' WITH GRANT OPTION;
//刷新系统权限表
flush privileges;

2、Create database from MySql

//创建数据库
drop database if exists icom;
create database icom DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
//先赋值本地权限
grant select,insert,update,delete,create,drop on icom.* to iusr@localhost 
Identified by "iusr123"; 
//后赋值所有权限
grant all privileges on icom.* to iusr@"%" Identified by "iusr123" WITH GRANT OPTION; 
use icom;
FLUSH  PRIVILEGES; 
注: icom数据库,iusr 用户名,iusr123密码

猜你喜欢

转载自blog.csdn.net/lishangke/article/details/81393449