我正在尝试在mac os 10.6上使用Homebrew by brew安装MySQL 5.1.52。
一切都很顺利,我也成功地使用mysql_install_db。
然而,当我试图连接到服务器使用:
/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin -u root password 'mypass'
我得到:
/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)'
我尝试访问mysqladmin或mysql使用-u root - root以及,
但是有没有密码都不行。
这是全新机器上的全新安装,据我所知,新安装必须在没有根密码的情况下访问。我还试过:
/usr/local/Cellar/mysql/5.1.52/bin/mysql_secure_installation
但我也得到了
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
下面是Sedorner上面写的关于如何从你的Mac上删除所有MySQL,然后用Brew Way安装它的详细说明:
根据技术实验室完全删除MySQL
ps -ax | grep mysql
stop and kill any MySQL processes
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
sudo rm -rf /tmp/mysql*
try to run mysql, it shouldn't work
从这个StackOverflow的答案酿造安装MySQL每用户Sedorner
酿造医生和修复任何错误
Brew remove mysql
啤酒清理
酿造更新
安装mysql
设置TMPDIR
Mysql_install_db——verbose——user= ' whoami '——basedir="$(brew——prefix mysql)"——datadir=/usr/local/var/mysql——tmpdir=/tmp # whoami inline执行
mysql。服务器启动
运行Brew建议的命令,将MySQL添加到launchctl中,以便在启动时自动启动
Mysql现在应该可以正常工作并一直正常运行
祝成功。