mysql 密码错误报错 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题
mac 版本5.7 brew 安装 brew reinstall mysql@5.7
根据输出提示操作:
vim ~/.bash_profile
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"
source ~/.bash_profile
/usr/local/opt/mysql@5.7/bin/mysql.server start
To connect run:
mysql -uroot
根据提示: mysql -uroot 发现不需要密码即可进入,坑爹啊,半天时间
5.7后版本 观察 安装完毕时 输出提示,有版本输出 随机密码 存于目录下
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles/mysql%405.7-5.7.29.catalina.bottle.tar.gz
Already downloaded: /Users/chenjiaxing/Library/Caches/Homebrew/downloads/fbe685d09ba668b38df6cd927290a5fcdfe91fb6e789e83e42ec7e07ef027b82--mysql@5.7-5.7.29.catalina.bottle.tar.gz
==> Reinstalling mysql@5.7
==> Pouring mysql@5.7-5.7.29.catalina.bottle.tar.gz
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have mysql@5.7 first in your PATH run:
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql@5.7 you may need to set:
export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"
To have launchd start mysql@5.7 now and restart at login:
brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
/usr/local/opt/mysql@5.7/bin/mysql.server start
==> Summary
🍺 /usr/local/Cellar/mysql@5.7/5.7.29: 319 files, 232.3MB