WordPress installation has been painless for me always but today it got me into trouble. Well, it was not wordpress it was mysql. Well, well not even mysql me myself. I forgot the root password. Whole story here –
I was setting up wordpress. It showed me a blank page while accessing wp-admin/install.php page for installation. I was left wondering!
Then I added in wp-config.php the following line:
define('WP_DEBUG', true); // debugging mode: 'true' = enable; 'false' = disable
This enabled debugging logs and I was able to get away from the “blank page” problem. It showed the error due to which the blank page was coming. WordPress could not connect to Database.
This got me to look into phpmyadmin and that gave the issue:
#1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
I had put a blank password in the configuration file and hence this error was encountered. I forgot the root password. Following solved the issue:
1. Stop the mysqld service.
2. Start the mysqld service in safe mode and without reading grant tables
mysqld --safe-mode --skip-grant-tables &
3. Now use the mysql client to connect with the daemon and change the password
MYSQL>UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root’;
4. Stop the safe mode daemon
5. Start the service normally.