Website Design

Changing the database table prefix in the SQL file for WordPress

Rushik Shah User Icon By: Rushik Shah

  • WordPress is a very versatile software that can be downloaded for free by just about anyone. It is an open source software and has grown in popularity lately.
  • The reason behind this is it simple and easy interface and overall ease of usability.
  • WordPress has a great many features that can be used to make several different kinds of websites.
  • In addition to that you have the option of installing plugins to your WordPress website. These plugins fulfill all the requirements that are not present on the default installation of WordPress.
  • In fact you use WordPress to make either a blog, a content management system, an e commerce website or even an informative website. But with every good website come good hackers as well.
  • WordPress website are often targeted by hackers just for the thrill of it which usually doesn’t result in loss of data but can result in downtime for sure.
  • Thus to avoid this there are several preventive measures you should take. Once such preventive measure is changing the default table prefix in the SQL file for your WordPress installation.
  • This article makes it fairly easy for anyone to make the changes, but if you feel it is not your cup of tea you can hire a professional WordPress web developer to do the job.
  • Alakmalak is one such WordPress Web development company in India that are involved in tasks big and small for WordPress.

It is possible to change the table prefix in the SQL file by following the steps below:

 

  • You first need to connect to your web server via FTP and navigate to the root directory of your WordPress installation.
  • Download the file wp-config.php and edit it in your favourite editor.
  • The file is divided into several sections and is well commented hence all you need to do is to look for the section which mentions WordPress Database Table Prefix’ and change the variable $table_prefix to the prefix of your choice.For example it can be changed to ‘bg’ by using the code below:  $table_prefix = “bg_”;
  • Once you have modified this file and changed the prefix to what you desire you will need save it and upload it back to the server via the same FTP.
  • Now it is time to change the database itself. Hence login to the your web server control panel.
  • Most web servers will have a database manager by the name ‘phpMyadmin’.
  • Use this to export your database into a SQL file.
  • Again open this file in your favourite editor and you will notice that the file has a prefix of ‘wp_’ if is the default one.
  • It is possible that it is something else if that was specified while installation, hence you really check it.
  • Assuming it is the default ‘wp_’, replace all the occurrences of ‘wp_’ with your new prefix, which in our case is ‘bg_’ .
  • Save this file and go back to the control panel of your server.
  • You will first need to drop the database and then upload the new one.
  • Use the ‘phpMyadmin’ software on your control panel once again, this time to import the database back into your server.
  • Refresh your website to make sure it is fully functional.

What’s Next ?

I know after reading such an interesting article you will be waiting for more. Here are the best opportunities waiting for you.

Share via
Copy link
Powered by Social Snap