首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >MySQL根密码无法按预期工作

MySQL根密码无法按预期工作
EN

Server Fault用户
提问于 2016-05-02 05:27:43
回答 1查看 1.2K关注 0票数 1

我在Ubuntu16.04上运行MariaDB 10.0.24。我通过异种回购apt-get install mariadb-server安装了它。

根密码似乎不能正常工作。我执行了这些步骤来设置密码:http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html,但是我得到了以下行为:

当我执行sudo mysqlsudo mysql -u root时,它可以让我进入控制台而无需询问密码(为什么没有密码就能进入控制台?)

当我做sudo mysql -u root -p时,它会问我一个密码,但是不管我输入了什么字符串,它都会让我进入mysql控制台。为什么当我输入一个错误的密码时它会让我进来?

当我执行mysql -u root时,它要求我输入密码,但不会接受我按照链接文章中的说明设置的密码。

显然有些事情不对劲。有人知道为什么它根本不从根请求密码,也不接受我的用户的密码?

EN

回答 1

Server Fault用户

回答已采纳

发布于 2016-05-02 05:45:46

sudo mysql && sudo mysql -u root,这是多余的命令。不访问密码,因为您有一个名为/root/.my.cnf的文件,其中包含客户端名称和密码

sudo mysql -u root -p请求passowrd,因为您将-p放在您的coammand中(参见man mysql)

代码语言:javascript
运行
复制
·   --password[=password], -p[password]

           The password to use when connecting to the server. If you use the short option form (-p), you cannot have a
           space between the option and the password. If you omit the password value following the --password or -p option
           on the command line, mysql prompts for one.

           Specifying a password on the command line should be considered insecure. See Section 6.1.2.1, “End-User
           Guidelines for Password Security”. You can use an option file to avoid giving the password on the command line.

请阅读电子用户密码安全指南。

,特别是针对用户问题的

由于Ubuntu16.04使用Xenial,这在他们控制某些事情的方式上有点奇怪,并且使用一个影响我们使用许多系统管理员的插件。

mysql>使用mysql;mysql>更新用户设置插件=‘’其中用户=‘root’;mysql>刷新权限;

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

https://serverfault.com/questions/774218

复制
相关文章

相似问题

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