mariadb密码和root用户的unix_socket身份验证 [英] mariadb password and unix_socket authentication for root

查看:1568
本文介绍了mariadb密码和root用户的unix_socket身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 16.04上的MariaDB上具有root用户.

I've a root User on the MariaDB on Ubuntu 16.04.

默认情况下,root用户通过unix_socket身份验证插件进行身份验证.

As default the root user is authenticated by the unix_socket authentication plugin.

我可以通过设置将身份验证方法切换为密码方法

I can switch the authentication method to password method by setting

update mysql.user set plugin='' where user='root';

这很好.但是...

是否可以通过unix_socket(通过root shell)或通过密码(通过localhost:3306连接)来验证root用户?

Is there a possibility to authenticate the root user by unix_socket (by root shell) or by password (when it is connected by localhost:3306)?

推荐答案

一种可靠而直接的方法是创建另一个超级用户,并在您想通过密码连接时使用它.

A reliable and straightforward way would be to create another super-user and use it when you want to connect by password.

CREATE USER admin@localhost IDENTIFIED BY 'password';
GRANT ALL ON *.* TO admin@localhost WITH GRANT OPTION;
-- etc

这篇关于mariadb密码和root用户的unix_socket身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆