-
登录数据库:mysql -u root -p
-
新建用户
2.1 create user 'newuser'@'%' identified with mysql_native_password_by 'fjh321';(mysql8)
2.2 create user 'newuser'@"%" identified by ''fjh321";(mysql5.7) -
授权
3.1 grant all privileges on . to 'fjh'@'%';
3.2 grant insert select delete update on . to 'fjh'@'%';
3.3 grant all privileges on 数据库.* to 'fjh'@'@';
3.4 flush privileges; -
显示账号及权限相关信息
4.1 show grant for 'fjh'@'%';
4.2 show create user 'fjh'@'%'; -
撤回用户权限
5.1 revoke all privileges on . from 'fjh'@'%'; -
删除用户
drop user 'fjh'@'%'; -
创建数据库
create database dataBaseName; -
创建表
create table tableName( id bigint not null );
网友评论