首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MariaDB完全忽略根密码

问MariaDB完全忽略根密码
EN

Server Fault用户
提问于 2016-05-19 15:36:29
回答 1查看 3.1K关注 0票数 3

我昨天刚在一个新下载的Ubuntu上安装了MariaDB (mysqld)。然后我运行了脚本

代码语言:javascript
复制
/usr/bin/mysql_secure_installation

并设置新的根密码并禁用无密码登录。但是,这没有起作用,所以我尝试从命令行中生成:

代码语言:javascript
复制
root@www:~# mysqladmin password whatever
root@www:~# mysql -uroot 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 10.0.24-MariaDB-7 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> \q
Bye
root@www:~# 
root@www:~# mysql -uroot -plkasjfdklajsfd
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 38
Server version: 10.0.24-MariaDB-7 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> select Host , User, Password from user;
+-----------+------+-------------------------------------------+
| Host      | User | Password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *90837F291B744BBE86DF95A37D2B2524185DBBF5 |
+-----------+------+-------------------------------------------+
1 row in set (0.00 sec)

为什么mysql会忽略我的密码更改指令,更糟糕的是,它允许以root用户身份进行无密码登录?

EN

回答 1

Server Fault用户

发布于 2018-02-15 07:26:16

一些基于Debian的发行版已经开始为根用户使用UNIX套接字身份验证插件。这意味着操作系统帐户链接到数据库根帐户,并且只有在拥有超级用户权限的情况下才能访问数据库。据我所知,这样做是为了使初始安装更加安全。

要验证导致这种情况的确实是UNIX身份验证插件,您可以以另一个用户的身份登录,并尝试使用mysql -uroot连接数据库。如果失败,您刚刚确认数据库使用UNIX套接字身份验证插件。

默认情况下,mysql客户端将使用本地UNIX域套接字连接到服务器。若要使用网络连接,请将环回地址作为带有-h 127.0.0.1的主机名。这将允许您以根用户的身份使用显式密码进行连接。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/777800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档