mac mysql5.7 不需要密码

mysql 密码错误报错 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题

 

mac 版本5.7    brew 安装  brew reinstall [email protected]

根据输出提示操作:

vim ~/.bash_profile
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

source ~/.bash_profile

/usr/local/opt/[email protected]/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 [email protected]
==> Pouring [email protected]
==> 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

[email protected] 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 [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"


To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysql.server start
==> Summary
  /usr/local/Cellar/[email protected]/5.7.29: 319 files, 232.3MB

 

你可能感兴趣的:(mysql)