mysql服务管理

  • 查看服务状态

systemctl status mysqld.service
  • 启动服务

systemctl start mysqld.service
  • 关闭服务

systemctl stop mysqld.service

用户权限管理

  • 创建用户

create user 'sgf'@'%' identified by 'SGF_lll315';
  • 查询用户

select user,host from mysql.user;
  • 删除用户

drop user sgf@'%';
  • 给用户授权

grant create,alter,drop,select,insert,update,delete on testdb.* to sgf@'%';
  • 刷新权限

flush privileges;
  • 查看权限

show grants for sgf;
05-11 19:31