Solution to Access Denied for User 'Root'@'localhost' (Using password:YES)

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

  • in mac
    • open the my.conf in the directory /usr/local/mysql
    • add skip-grant-tables
    • restart the mysql service
      • sudo /usr/local/mysql/bin/mysqld_safe &
    • then use mysql -uroot -p
      • you can login without password
      • then update the password after use mysql;
      • update user set password=PASSWORD("rootadmin") where user='root';
    • after that
      • delete the skip-grant-tables add in the my.conf file
    • restart the mysql service
    • then you can use the mysql -u root -q to login with your new password
php
Comments

Comments