Linux之Mysql权限设置

本文详细介绍如何在MySQL中配置skip-grant-tables跳过权限检查,重启服务,修改root账号密码,解决Host连接限制,以及为不同数据库分配特定用户权限。

修改 /etc/my.cnf,在 [mysqld] 小节下添加一行:

skip-grant-tables=1

重启mysql服务:

service mysqld restart

修改root账号密码:

 update user set authentication_string = password('xxx'), password_expired = 'N', password_last_changed = now() where user = 'root';

 连接过程中出现:Host is not allowed to connect this mysql service;执行如下命令

update user set host = '%' where user ='root'

 给不同的数据库分配不同的用户:

grant all privileges on db1.* to 'username1'@'%' identified by 'password1';
grant all privileges on db2.* to 'username2'@'%' identified by 'password2';

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值