MYSQL User Management
用户管理:
mysql.user:登陆数据库服务器的用户设置
mysql.db:访问具体数据库的权限设置
创建用户:
create user
对mysql.user表进行insert
使用GRANT
创建用户:create user <user name> identified by '<password>';
授权:grant <privileges> on <resource> to '<user name>'@'<mysql server>' identified by '<password>';
例如:
create user ebaytemp identified by 'ebaytest';
grant select,insert,update,delete,create,drop on ebaytemp.* to 'ebaytemp'@'localhost' identified by 'ebaytest';
grant all privileges on SEANEW.* to 'ARV033'@'%' identified by 'Mxkde5fz';
删除用户:
drop user
对mysql.user表进行delete
密码修改:
root:/usr/bin/mysqladmin -u root password 123456
普通用户:set password=password('新密码')
root密码丢失:
1. 停止mysql服务:/etc/init.d/mysqld stop 或者 kill -9 mysql相关进程
2. 启动mysql服务:/etc/init.d/mysqld --skip-grant-tables
3. 登录root用户:mysql -uroot
4. 重置密码:
use mysql
update user set password=password('新密码') where user='root';
Comments
Post a Comment