Reset Mysql Root password

If you are getting this error:

Error: Access denied for user ‘root’@’localhost’ (using password: YES)

Basic commands to start/stop/restart mysql from Command line

On OS X to start/stop/restart MySQL pre 5.7  from the command line:

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

These are the steps you need to follow:

  1. Stop Mysql server (
    sudo /usr/local/mysql/support-files/mysql.server stop
  2. Start mysql with the following option “/path/to/mysqld –skip-grant-tables ”
     sudo /usr/local/mysql/support-files/mysql.server start--skip-grant-tab
    les
  3. Connect to Mysql ($ mysql)
  4. Update the password

    update user set authentication_string=password(‘NEW PASSWORD’) where user=’root’;

    5. Restart mysql server

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s