I would like to change the name of tables in my database, which are used for my Prestashop installation.
The database contents used for the prestashop installation are named with a prefix. This prefix (e.g. PS_, or PSgu72he_) makes it possible to distinguish the files of one installation from other files in the same database which are not related to the prestashop installation. You can choose this prefix during installation. Maybe you don’t like this prefix any more, or have another motivation to change it.
To change the database prefix in Prestashop, you need access to the sql database. Usually this is done with phpMyAdmin. You can get access to this through your webhoster. It should be linked in the hosting provider’s customer area (Plesk or otherwise). (Should you not have acces to this, you may have to upgrade your webhosting package, or find a different solution.)
Once you are logged in, you click on your database and mark all entries which you want to change. When an entire page contains entries which you want to change, in the bottom of the screen you can find a tickbox “check all”.
It does what it says, and ticks all the boxes on that page.
Next to this checkbox, there is a dropdown called “With selected:”. In the menu you can pick the option “Replace prefix”.
Here, you enter the exact prefix as it is commonly named, including “_”, and below you enter the prefix as you would like it to be named. “Submit” executes the query, and the prefixes are changed. Repeat, if necessary, until everything is named to your liking.
Perhaps now the prefix is different from the expected prefix in you prestashop installation. Should this be the case, you will get an error message 500, internal server error. Prestashop doesn’t find any of its tables any more! Shocking, but there is an easy way to fix adjust this.
Where is the database connection for Prestashop stored?
Previously, this information was stored in settings.inc.php. This file is deprecated (=made obsolete) with version 1.7.
In Prestashop version 1.7, this info is stored here:
All you need to do is locate the line called ” ‘database_prefix’ => ‘YourCurrentPrefix_’,” – here you change the prefix, save and upload the file and you are good to go.