I cannot login to mysql since I forgot (I lost!) the temporary password I received after installing mysql. So I tried the following steps but they didn't help me:
- I stopped mysql server
- Then I created a file in
/usr/local/mysql/support-files/
,calledrestore
, in which I wrote this line:SET PASSWORD FOR root@localhost=PASSWORD('');
- Finally I ran this command:
sudo mysqld_safe --init-file=/usr/local/mysql/support-files/restore
but it stuck onmysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
. However I checked mysql from system preference and it already started (showing "mysql is running") - I tried to login to mysql again with this command
mysql -u root
, but still I receive the same error:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Could someone please help me fix this problem ?