如何獲得mysql安裝並能夠使用它?避免'訪問拒絕用戶root'@'localhost'(使用密碼:否)'
我已經試過:在CLI
$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.9.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/mysql-5.7.9.yosemite.bottle.tar.gz
==> Pouring mysql-5.7.9.yosemite.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> Summary
/usr/local/Cellar/mysql/5.7.9: 12629 files, 464M
$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
$ mysql.server start
Starting MySQL
SUCCESS!
$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
$
我這樣做,但我不知道使用的PW。 '$ mysql -uroot -p 輸入密碼: 錯誤1045(28000):訪問被用戶'root'@'localhost'拒絕(使用密碼:否) ' –
您需要MySQL的root密碼 –