You can really mess up your WordPress website. If you don’t know what you are doing, things can go from bad to worse very quickly, especially if you go changing your password. I was trying to figure out a strange issue that resulted in my site title showing up twice when a post was shared on Facebook. It ended up being how I structured the permalink (I think…), but that is another story. I had the bright idea to go into the database administration and have a look around. It was then the problems started.
Whatever you do, don’t change your password
I could not remember my database administration password. I did not write it down (good and bad). I needed to change it so I could access the database administration area via phpMyAdmin. I went to my hosting control panel (at GoDaddy) and reset the password. At that time, my site could not communicate with the database. Being written in PHP, databases store EVERYTHING in WordPress. Not being able to communicate with the database is, in a word, bad. Of course, I had not backed up my site and downloaded my content (I did have access to FTP, so I was not completely dead in the water). Since I had reset the password and could not undo that, I was stuck… or was I?
I have a little background in PHP. After deciding to learn more about it, I began to build what I call an online application (basically a website to keep up with automobile maintenance running on a local server). I struggled and built for months and enjoyed every minute. If nothing else, that first foray into PHP programming provided me with a vague understanding of the syntax and better, the file structure.
So, I had a database my pages could not communicate with. I had a brand new password that was useless. How was I going to fix this? Google was of little help. Apparently, all the help pages deal with resetting your WordPress password if you can access the MySQL server or phpMyAdmin. I had a similar but much too different problem. After about half an hour of searching, I recalled some information about the PHP file structure. That made all the difference in the world.
To be useful, PHP must establish a connection with the database. Hard coded somewhere on your site (in plain text), there should be the name or address of the server your site is located on (even if it is local), the user name for the login, and… wait for it… the password. This information is hard coded in a PHP page and the information in that page is included with every PHP page that needs access to the database. Since the password is in a file that is not accessible to the public, the password is safe while accessible to the pages when needed. After finding wp-config.php via FTP, all I had to do is change the password there (which is what I did) or copy the password and change it on the server to match. A very simple fix to what could have been a massive problem.
What did I learn? I learned that I could actually stay calm in the face of losing over six months worth of posts. I realized most problems are not as bad as they seem. I learned not to mess with passwords unless I have NO other choice. Hope this how-to helps you and may you never have this problem.