# 查看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 # 添加这一行
标签:etc,local,cnf,密码,MySQL8.0,ls,Brew,my,usr From: https://www.cnblogs.com/hefeng2014/p/17828731.html