mysql非root用户密码,CenterOS 8上修改msql的root密码和新增非root用户步骤

步骤一:

登录mysql,输入mysql -uroot -p并回车,此时登录成功。

步骤二:

检查mysql表是否可以看见,输入show databases;并回车。

步骤三:

查看root用户和其他用户之前的密码:

select host, user, password from mysql.user;

步骤四:

修改root用户密码:

Grant all privileges on *.* to 'root’@‘*' identified by '123456!' with grant option;

Grant all privileges on *.* to 'root’@'localhost' identified by '123456!' with grant option;

Grant all privileges on *.* to 'root’@‘127.0.0.1' identified by '123456!' with grant option;

步骤五:

新增michal并设置dink库的密码:

Grant all privileges on *dink* to ‘michal’@‘*' identified by '123456!' with grant option;

Grant all privileges on *dink* to ‘michal’@'localhost' identified by '123456!' with grant option;

Grant all privileges on *dink* to ‘michal’@‘127.0.0.1' identified by '123456!' with grant option;

步骤六:

执行刷新操作:

flush privileges;

步骤七:

查看root用户和其他用户之前的密码是否已经修改

select host, user, password from mysql.user;

步骤八:

退出命令行

quit

步骤十三:

重启mysql服务:

service mysqld restart

步骤十四:

执行命令,输入密码看是否能正常访问

mysql -uroot -p

mysql -umichal -p

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值