【问题标题】:Reset MySQL / MariaDB password on OSX在 OSX 上重置 MySQL / MariaDB 密码
【发布时间】:2019-08-16 07:05:42
【问题描述】:

在关注this guide 之后,我通过 Homebrew 安装了 MariaDB。它一直运行良好,但是今天 root 密码已过期,我似乎无法使用任何 —skip-grant-tables —skip-networking 类型选项重置它。

到目前为止我已经尝试过:

brew services stop mariadb
mysqld_safe --skip-grant-tables --skip-networking
mysql_secure_installation

也试过

mysql_secure_installation --connect-expired-password

这给了我:

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
/usr/local/Cellar/mariadb/10.3.13_1/bin/mysql: unknown option '--connect-expired-password'
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
/usr/local/Cellar/mariadb/10.3.13_1/bin/mysql: unknown option '--connect-expired-password'
Password update failed!
Cleaning up...

我还添加了:

[mysqld]
default_password_lifetime=0
skip-grant-tables

/usr/local/etc/my.cnf

仍然不允许我使用上述命令更新 root 密码。 Brew Doctor 干净利落地回来了,我已经没有东西可以尝试了。

【问题讨论】:

    标签: mysql mariadb homebrew


    【解决方案1】:

    结束运行/usr/local/mysql/bin/mysqladmin -u root -p password 并设置新密码。

    【讨论】:

      【解决方案2】:

      登录

      mysql -uroot
      

      那就做吧

      set password = password("your_password");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-12-31
        • 1970-01-01
        • 1970-01-01
        • 2015-08-26
        • 2021-04-19
        • 2018-02-19
        • 2017-01-21
        • 2016-10-10
        相关资源
        最近更新 更多