6

According to this question Access Denied for MYSQL ERROR 1045 I should be able to start MySQL in safe mode with

sudo mysqld_safe --skip-grant-tables

but this simply logs the following lines to STDOUT:

151116 17:46:46 mysqld_safe Logging to '/usr/local/var/mysql/MacBook-Pro.local.err'.
151116 17:46:46 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
151116 17:46:46 mysqld_safe mysqld from pid file /usr/local/var/mysql/MacBook-Pro.local.pid ended

and returns me to the command line. The error log quoted has the same last 2 lines output here. When I try and connect to MySQL I get:

mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Community
  • 1
  • 1
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

1 Answers1

5

Just encountered exact same issue on mac. I was able to reset the root password with following steps.

mysqld --skip-grant-tables  # this will run mysql 
    
mysql -u root
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';

NOTE: Seems like newer version of mysql has error when running 'sudo mysqld_safe --skip-grant-tables'.

ibaralf
  • 12,218
  • 5
  • 47
  • 69