If you have a problem with a localhost application, you should never, ever uninstall your localhost server (WAMP/MAMP/XAMPP/UniServer/etc) because that will permanently destroy all databases you have defined. Instead, you should try to fix the database and/or application files, and if that doesn’t work, delete and then re-install the application. Again, never delete and re-install the server!
Now, to your specific problem. Since you uninstalled your localhost server, you destroyed all your old databases and database users, meaning that the information in the wp-config file is not valid. You will need to create a new database user and database, and then update wp-config.php with this new information.
However, none of this was necessary. I’m posting this here in the hopes it will help someone else who forgot the password to their admin account. What I’m going to describe will work on any server whose WP database can be accessed by phpMyAdmin. Those knowledgeable enough to use MySQL from the cammand line would have already solved the problem. ??
If one forgets the password to the main account, all is not lost. (Though many people will tell you it is because they are looking to make some money, but I digress.) It is possible to replace the password in the database with a known password, and once logged in, you can reset the password to whatever you want. Here’s how to do that. Note that this requires phpMyAdmin and also that you didn’t uninstall your localhost server.
First, start phpMyAdmin and select your database. Next, select the (prefix)_users table, where (prefix) is the table prefix you set in the wp-config.php file. It’s usually “wp”, so the table is usually named wp_users.
Now locate the line that contains the username of your account, and double-click the password field, and replace the password with the following:
$P$BSrY4VDPCajfR6UT4axL8m9S.sNPV10
Once the password is replaced, click anywhere outside the field to save the new password. Now select any other table, then select the wp_users table again, go back to the line with your account, and verify the password is the same as the one above.
You will now be able to log in to your WordPress installation using your username and the password:
password
You can now change the password to anything else…preferably to something you will remember. ??