Stuck with Access Denied for user 'root'@'localhost' - Terminal, Mac

One method:

  1. stop your MySQL server.
  2. start your MySQL server with the --skip-grant-tables option. It allows you to connect to the server without a password.

    /path/to/mysqld --skip-grant-tables &
    
  3. connect to your server using the mysql client:

    mysql
    
  4. change the root password (replace NewPassord by what you want):

    UPDATE mysql.user SET password=PASSWORD('NewPassord') WHERE user='root';
    
  5. restart yout MySQL server.

There are others ways to reset the MySQL root password: http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html

Tags:

Mysql

Terminal