我在Ubuntu16.04上运行MariaDB 10.0.24。我通过异种回购apt-get install mariadb-server
安装了它。
根密码似乎不能正常工作。我执行了这些步骤来设置密码:http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html,但是我得到了以下行为:
当我执行sudo mysql
或sudo mysql -u root
时,它可以让我进入控制台而无需询问密码(为什么没有密码就能进入控制台?)
当我做sudo mysql -u root -p
时,它会问我一个密码,但是不管我输入了什么字符串,它都会让我进入mysql控制台。为什么当我输入一个错误的密码时它会让我进来?
当我执行mysql -u root
时,它要求我输入密码,但不会接受我按照链接文章中的说明设置的密码。
显然有些事情不对劲。有人知道为什么它根本不从根请求密码,也不接受我的用户的密码?
发布于 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
)
· --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>刷新权限;
https://serverfault.com/questions/774218
复制相似问题