在 macOS 上 brew install mysql - brew install mysql on macOS

问题:

I'm trying to setup up MySQL on mac os 10.6 using Homebrew by brew install mysql 5.1.52 .我正在尝试通过brew install mysql 5.1.52使用 Homebrew 在 mac os 10.6 上设置 MySQL。

Everything goes well and I am also successful with the mysql_install_db .一切顺利,我也成功使用mysql_install_db
However when I try to connect to the server using:但是,当我尝试使用以下方法连接到服务器时:

/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin -u root password 'mypass'

I get:我得到:

/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin: connect to server at 'localhost' 
failed error: 'Access denied for user 'root'@'localhost' (using password: NO)'

I've tried to access mysqladmin or mysql using -u root -proot as well,我也尝试mysqladmin or mysql using -u root -proot访问mysqladmin or mysql using -u root -proot
but it doesn't work with or without password.但无论有没有密码它都不起作用。

This is a brand new installation on a brand new machine and as far as I know the new installation must be accessible without a root password.这是在全新机器上的全新安装,据我所知,新安装必须无需 root 密码即可访问。 I also tried:我也试过:

/usr/local/Cellar/mysql/5.1.52/bin/mysql_secure_installation

but I also get但我也得到

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

解决方案:

参考一: https://stackoom.com/question/II0Z
参考二: brew install mysql on macOS
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章