mysql 相关操作记录
新建用户
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
给数据库赋权
GRANT ALL ON databasename.tablename TO 'username'@'host';
-- 一个库的所有表赋权
GRANT ALL ON databasename.* TO 'username'@'%';
-- 特定的操作和表
GRANT SELECT, INSERT ON test.user TO 'pig'@'%';
-- 所有的库及表
GRANT ALL ON *.* TO 'pig'@'%';
修改密码
SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');
-- 如果是当前用户
SET PASSWORD = PASSWORD("newpassword");
本文来自博客园,作者:Chuan_Chen,转载请注明原文链接:https://www.cnblogs.com/wangcc7/p/17270899.html