Job2 Street

Saturday, December 21, 2019

Change Your WordPress Database Name in 3 Simple Steps

Change Your WordPress Database Name in 3 Simple Steps

Your WordPress database holds all of your site’s important information, so keeping it safe and organized isn’t something that should be neglected.

Naming your database in a descriptive way can help you more easily keep track of your site and help prevent you from making unintended changes when you can’t tell your databases apart. It also helps protect your site by making it more difficult for hackers to identify and access your database details.
It’s easy to change your database from a default name like db_wordpress123 to db_mysite and it can be done in about five minutes. In this Weekend WordPress Project, I’ll show you how to change the end of your database name to something more recognizable to you, while also being less guessable for hackers.

Edit Your Database

Head over to phpMyAdmin. In cPanel, you can access it through the Databases section of the home page. Once there, select your database from the menu on the left, then click the Operations tab at the top.
The operations tab has been clicked in phpMyAdmin after a database has been selected.
You can rename your database to whatever you would like as long as you only include letters and numbers.
Under Rename database to, enter the name you would like to see for your database in the text field and click Go on the bottom, right corner of field. You will be prompted with a pop-up to accept the change.
You will be creating a new database with your chosen name, dropping the tables in your original, then importing those tables to your new database. Click OK to continue with these changes.

Edit Your wp-config.php File

Navigate to your site’s files and in the root of your WordPress install, locate your wp-config.php file. In cPanel, edit the file by selecting it from the list and clicking the Edit button at the top of the page. If a pop-up appears, click Edit again.
You can also choose to download the file through FTP and edit it with a text editor. Either way, include your new database name by finding the piece of code similar to the one below:
https://gist.github.com/jennimckinnon/61816227d6525a28c8a1
Find define('DB_NAME', 'your_db'); in your file, where your_db is the original name of your database and change it to the new name you chose a moment ago.
Save the file and if you’re using FTP, upload the new file to the root of your install.

Assign a Database User

In cPanel, click on MySQL Databases under the Databases section. Scroll down to the Add a User to a Database area and select your username from the User drop down box.
If you’re not sure what it is, it’s listed in your wp-config.php file on the line with DB_USER just like in the example above.
Next, select your new database name from the Database drop down box and finally, click the Add button. On the page that loads, select the All Privileges checkbox toward the top, then click the Make Changes button below the table.
The "All Privileges" checkbox has been selected and the "Make Changes" button is highlighted.
Make sure all the boxes are checked unless you are adding additional users to the database and would like them to have different permissions.
Reactivate all your plugins and you’re done!

No comments:

Post a Comment

K-Play

kPlaylist - get your music online

The player will show in this paragraph

2 3

IkimFM

speaker music speaker