MacOSX homebrew mysql root password

前端 未结 21 1609
自闭症患者
自闭症患者 2020-12-04 05:43

For some reason MySQL stopped giving access for root. Uninstalled and reinstalled with Homebrew. Fresh install, fresh tables but when I enter

mysql -u root -         


        
21条回答
  •  独厮守ぢ
    2020-12-04 06:20

    I had the same problem a couple days ago. It happens when you install mysql via homebrew and run the initialization script (mysql_install_db) before starting the mysql daemon.

    To fix it, you can delete mysql data files, restart the service and then run the initialization script:

    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    rm -r /usr/local/var/mysql/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    

提交回复
热议问题