修改Mysql用户验证的插件

本次采用默认安装的mysqlD(MariaDB),root用户默认的验证插件是VIA unix socket的。
当通过phpmyadmin等登陆时候,会报错误,拒绝用户登陆;

主要修改命令:

update user set plugin="mysql_native_password";

修改完成后:

MariaDB [mysql]> select host,user,password,plugin from user limit 1;
+-----------+------+-------------------------------------------+-----------------------+
| host      | user | password                                  | plugin                |
+-----------+------+-------------------------------------------+-----------------------+
| localhost | root | *Cdddddddddd029230220C8A6F | mysql_native_password |
+-----------+------+-------------------------------------------+-----------------------+

后面的只是完整过程,意义不大。

/etc/init.d/mysql stop
sudo killall mysqld_safe
sudo killall mysqld
sudo mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
update user set plugin="mysql_native_password";
quit;
/etc/init.d/mysql stop
sudo kill -9 $(pgrep mysql)
/etc/init.d/mysql start

发表评论

电子邮件地址不会被公开。 必填项已用*标注