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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章