mariadb修改用户密码

作者: jekkay 分类: 数据库 发布时间: 2020-02-11 15:02

简述

maridb安装之后,直接以root用户登录之后,发现密码都是$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED,需要手动修改一下密码,其方法和mysql有所区别。

修改密码

mariadb和mysql修改用户密码有所区别,password函数不再有用,建议使用一下命令修改密码。

mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.08 sec)

mysql> alter user 'root'@'%' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.09 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)


创建新用户

mysql> 
mysql> create user 'develop'@'%' identified with mysql_native_password by 'develop';
Query OK, 0 rows affected (0.10 sec)

mysql> create user 'develop'@'localhost' identified with mysql_native_password by 'develop';
Query OK, 0 rows affected (0.10 sec)

mysql> grant all on *.* to 'develop'@'localhost';
Query OK, 0 rows affected (0.11 sec)

mysql> grant all on *.* to 'develop'@'%';
Query OK, 0 rows affected (0.08 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论