Mastodon Skip to main content

How to Secure and Edit Database Prefix. | #DBSecurity

One way to help in securing your WordPress site is to make it as difficult as possible for the bad people to break in. Duh! One way to do this is to avoid using the default database prefix wp_.

Now if you have not yet installed WordPress and you have access to the one-click install program called Softaculous, then you can make this change before you’ve installed WordPress. You can also change the database prefix manually after you have WordPress installed. The manual way is best done on a new install but you can still do it on a seasoned site just as easy. If however, you don’t want to get your hands dirty, then there are plug-ins you can install on your already installed WordPress site that can do all the heavy lifting for you.

This plug-in might be a little bit iffy and they come with a little bit of a learning curve. I myself prefer the easiest way possible but in case something breaks along the way, I’d also like to have some idea where to look in order to fix it. So, this video is going to show you how to manually edit your database prefix in less than 5 minutes, however, you decide to alter your database prefix, you want to have a fresh full backup of both your files and database before doing this.

Now that you have your new backup created, let’s go ahead and login to our service control panel, and in this demo, I’m going to be using the control panel, C-panel. Wait, before you do that, I want to show you that this site does work and that hopefully, it will do the same thing once we’re done editing our database prefix so let’s come on over to C-panel and we want to come on down here to our phpMyAdmin and we want to… oh wait, yep. If you’ve got multiple databases, then you want to make sure you're editing the right one. Now, one way to make sure you’ve got the right database is to come on back here to file manager on your control panel. Click on file manager, come on down to wp-config.php file. So like that, click on code editor and then edit, and then right here is the name that we’re going to be editing. So that would be the 248, that’s going to be this guy right here.

Now, I also want to mention that I’m going to go and leave this guy open because once we change the name of our prefix on our database, we have to come back to our config file and change it here as well. Okay? So I’m going to go ahead and leave this guy open, come on back here. Oh, and before you get things started, let me bring in my timer here just to show you that it is going to be done in less than 5 minutes. As a matter of fact, spoiler alert, I’m going to show you two different ways you can do this. So let’s go ahead and click on this. Wait, let’s start the timer first, make it official.

Okay, now let’s click on this. come on in here and of course, a lot of this is going to depend on your internet speed because there is some downloading and uploading involved but let’s come over here to export, and click on go. Navigate to the location on your computer where you want to download this SQL database too. Okay, that’s done. Let’s get this out of the way. Open up that directory because we don’t really want to work on the one we just downloaded. We want to keep that as a kind of a backup. Let’s go ahead and click on copy and paste.

Next, I’ll keep this guy name copy as the backup and we’ll open this guy up with notepad or WordPad. Notepad will work just as well but it looks like gibberish so let’s go ahead and use WordPad because there are some formatting involved here. Come on up here to home, go to replace, we’re going to find the wp_ and we want to replace it with our new one which is… let’s give it a name GOTU_ and replace all. Now, if you’ve got a whole lot of funky plug-ins installed and activated, and it’s a real seasoned site, you may want to go ahead and replace one at a time because some plug-ins will use wp_ a couple of times in the path of that plug-in and you only want to change the first instance within that path, not all of them. So when you click on replace all, anything in here that has wp_ is going to change. So you may want to do this one at a time if you’ve got a seasoned site. If it’s a brand new site with minimal plug-ins, boom! Do that. And we’re done. Okay!

Now then, let’s go ahead and cancel this. Let’s go ahead and make sure… so we got that one changed. So we got that one changed, we’ve got them all changed. Click on save. So we’re good. Click data here. We know that guy is still okay and intact so let’s go and upload this back into our database. Get this out of the way, come on back up here, and let’s go ahead and select all of these guys here. Let’s clean out our database right now if these are all still under wp_. With all those selected, we want to drop them, get them out of here. Click on yes and they’re gone.

Now, we want to come up here to import, chose file, that’s the guy right there, come on down here. Click on go, and we’re good. Click on refresh just to make sure. Come on back here to our wp-config file, change that to GOTU_. Come up here and click on save. And that should be good.

Come on over here to our blog and refresh, and if it’s not broke, then it’s going to work. Cool. And we’ve got, what? 3 minutes? Okay. So we’re good to go.

Now, another way to do this since I’ve got a little bit of time left. You come on back over here, come on back up here. We then select all of these files or tables rather, over here too with selected, replace table prefix. Click on that. Right here, go from GOTU_ to WP_, or whatever you want. WPT_ click on submit and there you are. Refresh, come on back here. Was that, WPT_, click on save, come on back here, refresh, and it’s still working.

So that’s 2 ways for the price of one. In both ways, we’re done in under 5 minutes in how you can change your database prefix from the wp_ to whatever you want. That’s going to bring us to the end of this video on Editing Your Database Prefix In Under 5 Minutes.
Thanks for watching and you have a great day.

Related posts:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our newsletter

Discover more from Anantvijaysoni.in

Subscribe now to keep reading and get access to the full archive.

Continue reading