MariaDB - cannot login as root(MariaDB - 无法以 root 身份登录)
问题描述
我正在尝试在 Ubuntu (16.04.02) 上设置 MariaDB (10.0.29).在我安装它并启动进程(sudo service mysql start)后,即使我最初将密码设置为空白,我也无法以 root 身份登录.
I am trying to setup MariaDB (10.0.29) on Ubuntu (16.04.02). After I installed it and started the process (sudo service mysql start), I cannot login as root even though I originally set the password to blank.
即 mysql -u root 将拒绝我访问.我通过 sudo mysql 登录并检查了用户表,即.select user, password, authentication_string from mysql.user 和预期的一样:
Ie mysql -u root will deny me access. I logged in through sudo mysql and checked the user table, ie. select user, password, authentication_string from mysql.user and as expected:
+---------+----------+-----------------------+
| User | password | authentication_string |
+---------+----------+-----------------------+
| root | | |
+---------+----------+-----------------------+
我还创建了一个新用户,即.create user 'test'@'localhost' identify by ''; 当我尝试执行 mysql -u test (空密码)时,它按预期工作并记录我在.
I also created a new user, ie. create user 'test'@'localhost' identified by ''; and when I try to do mysql -u test (empty password), it works as expected and logs me in.
用户表如下所示:
+---------+----------+-----------------------+
| User | password | authentication_string |
+---------+----------+-----------------------+
| root | | |
| test | | |
+---------+----------+-----------------------+
那么,谁能告诉我为什么我不能以 root 的身份使用空密码登录,但我可以以 test 的身份登录?
So, can anyone tell me why I cannot login as root with empty password but I can login as test?
推荐答案
与原生 MariaDB 包(MariaDB 自身提供的包)不同,Ubuntu 生成的包默认具有 unix_socket 本地根身份验证.要检查,请运行
Unlike native MariaDB packages (those provided by MariaDB itself), packages generated by Ubuntu by default have unix_socket authentication for the local root. To check, run
SELECT user, host, plugin FROM mysql.user;
如果您在 plugin 列中看到 unix_socket,这就是原因.
If you see unix_socket in the plugin column, that's the reason.
要返回通常的密码验证,请运行
To return to the usual password authentication, run
UPDATE mysql.user SET plugin = '' WHERE plugin = 'unix_socket';
FLUSH PRIVILEGES;
(选择适合您目的的 WHERE 子句,以上只是示例)
(choose the WHERE clause which fits your purposes, the one above is just an example)
这篇关于MariaDB - 无法以 root 身份登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MariaDB - 无法以 root 身份登录
基础教程推荐
- 是否可以执行按位分组功能? 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 无法解决整理冲突 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
