Enable password and unix_socket authentication for MariaDB root user?(为 MariaDB 根用户启用密码和 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 根用户启用密码和 unix_socket 身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为 MariaDB 根用户启用密码和 unix_socket 身份验证?


- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01