MacOSX homebrew mysql root password

前端 未结 21 1647
自闭症患者
自闭症患者 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条回答
  •  旧时难觅i
    2020-12-04 06:12

    None of these worked for me. I think i already had mysql somewhere on my computer so a password was set there or something. After spending hours trying every solution out there this is what worked for me:

    $ brew services stop mysql
    $ pkill mysqld
    $ rm -rf /usr/local/var/mysql/ # NOTE: this will delete your existing database!!!
    $ brew postinstall mysql
    $ brew services restart mysql
    $ mysql -uroot
    

    all credit to @Ghrua

提交回复
热议问题