Brew安装的MySQL8.0忘记密码修改密码

发布时间 2023-11-13 11:17:34作者: 苦逼vs猴子
# 查看my.ini位置
$ mysqld --help --verbose | more


# 找到这一行,挨个试试,看存不存在
# /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

$ ls /etc/my.cnf
ls: /etc/my.cnf: No such file or directory

$ ls /etc/mysql/my.cnf
ls: /etc/mysql/my.cnf: No such file or directory

$ ls /usr/local/etc/my.cnf
/usr/local/etc/my.cnf    # 注意这个文件存在了


# 修改配置文件, 添加 skip-grant-tables
$ cat /usr/local/etc/my.cnf
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
skip-grant-tables   # 添加这一行

来源:https://blog.51cto.com/mouday/5057428