3

I'm using SequelPro (http://www.sequelpro.com/) and I would like to know how to reset my root password. I'm trying to log in as

host: localhost
username: root
password: (BLANK)

But I keep getting this error:

Unable to connect to host because access was denied.
Double-check your username and password and ensure that access from your current location is permitted.
MySQL said: Access denied for user 'root'@'localhost' (using password: NO)

Any suggestions?!

2 Answers 2

3

Depending on what you're using to run MySQL, you could take a look at the official instructions.

If you're using MAMP or something similar you need to find where mysqladmin is located.

/Applications/MAMP/Library/bin/mysqladmin -u root -p password ’somepassword’

If you are using another installation of mysql, you may be able to find out where it is located with:

$ which mysqladmin 
2
  • Thanks! I was using the program MySQL. I started using MAMP thanks to your suggestion, and now it all works. Thanks again! Commented Mar 25, 2010 at 14:37
  • Just an FWI you can accept this as the answer by clicking the check mark under the vote indicators. Glad it helped.
    – Josh K
    Commented Mar 25, 2010 at 15:26
3

Here is the procedure to reset password of root user.

1) Stop mysql (Kill mysql process or run following command)

sudo /usr/local/mysql/support-files/mysql.server stop

2) Start it in safe mode

sudo mysqld_safe --skip-grant-tables

3) Open another terminal and run the following command (Keep last terminal open)

mysql -u root

4) Run the following command with suitable new password on the mysql console

mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';

5) mysql > FLUSH PRIVILEGES;

6) Quit from both terminals and open new terminal and connect to mysql with root user and new password

mysql -uroot -p
1
  • old post but still relevant - for step 3 on Mac OS Mojave run sudo mysql -u root
    – rwcorbett
    Commented Aug 2, 2019 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .