I am attempting to setup up mysql on mac os 10.6 using Homebrew by brew install mysql 5.1.52

everything goes well and i'm also effective using the mysql_install_db.
However, if i attempt for connecting towards the server using:

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

I recieve:

/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin: connect with server at 'localhost'

unsuccessful error: 'Access refused for user 'root'@'localhost' (using password: NO)'

I have attempted to gain access to mysqladmin or mysql using -u root -proot too,
however it does not work without or with password.

This can be a completely new installation on the completely new machine and so far as I understand the brand new installation should be accessible with no root password. I additionally attempted:


however i will also get

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

Had exactly the same problem. Appears like there's a problem using the setup instructions or even the initial tables which are being produced. This is the way I acquired mysqld running on my small machine.

When the mysqld server has already been running in your Mac, stop it first with:

launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

Start the mysqld server using the following command which allows anybody sign in with full permissions.

mysqld_safe --skip-grant-tables

Then run mysql -u root that ought to now allow you to sign in effectively with no password. The next command should totally reset all of the root passwords.

UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root' FLUSH Rights

If you get rid of the running copy of mysqld_safe and begin up again with no skip-grant-tables option, you need to have the ability to sign in with mysql -u root -p and also the new password you simply set.

I believe it's possible to finish up within this position with older versions of mysql already installed. I'd exactly the same problem and no above solutions labored for me personally. I fixed it thus:

Used brew's remove &lifier cleanup instructions, unloaded the launchctl script, then erased the mysql directory in /usr/local/var, erased my existing /etc/my.cnf (leave that certain your decision, should it apply) and launchctl plist


    brew remove mysql

    brew cleanup

    launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

    rm ~/Library/LaunchAgents/com.mysql.mysqld.plist

Then i began on your own:

  1. installed mysql with brew install mysql
  2. went the instructions brew recommended:

    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  3. Used the alternate security script:

  4. Adopted the launchctl section in the brew package script output

  5. Boom.

Hope that can help someone!

I'd exactly the same problem at the moment. Should you brew info mysql and stick to the steps it appears such as the root password ought to be new-password basically remember properly. I had been seeing exactly the same factor you're seeing. This short article assisted me probably the most.

It switched out I did not have any accounts produced for me personally. After I drenched in after running mysqld_safe and did choose * from user no rows were came back. I opened up the MySQLWorkbench using the mysqld_safe running and added a root account with the privs I was expecting. This will work well for me personally now.

This is an problem with Lion presently. This will work with ya

brew install https://raw.github.com/adamv/homebrew-alt/master/versions/mysql51.rb

Try by providing Grant permission Command of mysql