Changing Your Admin Email on WordPress
-
Most guides assume a poor WordPress hosting scenario with cPanel and phpMyAdmin. Well not here. Let's do this for real. Changing your admin email is easy from the GUI when email works, but when it doesn't it is a pain. And not everyone uses cheap, generic cPanel style hosting so let's do this the serious way from the command line talking to our database (assuming MariaDB or MySQL.)
We need two pieces of information to start: the name of your database and your WordPress tables prefix (which is often wp_ but you never know.) Both things can be looked up in your wp-config.php file should you be unsure. Or in most cases, you can log into your database and poke around for two seconds and figure it out. Either way, it's pretty easy.
So let's connect to our database with the mysql command. You'll need your database username and password to get access. If you don't have the root or some other admin account, you'll need the ones from WordPress. Again, they are located in the same configuration file as the database name and tables prefix. Also, we assume this is a locally running database, if not, you'll need connection details as well, but that's very rare.
If we log in successfully, we get the mysql command prompt and can issue SQL commands directly to the database. First things first, we need to switch into our database for our WordPress instance:
use mydatabasename;
Now we can quickly query the database to see what the old entry looks like. In my example, we are using wp_ as the prefix. It's possible that you have no prefix or something different. Every table in your DB will start with this, so a quick look helps you to figure it out.
SELECT * FROM wp_options WHERE option_name="admin_email";
This should return your current email setting. Now we just need to update it.
UPDATE wp_options SET option_value="[email protected]" WHERE option_name="admin_email";
That's it, all done. So much easier than all these GUI tools everyone keeps pushing.