Jump to content

How to modify the Database prefix after installation to avoid possible sql injection?


Recommended Posts

Could we do this from Back Office->Preference->Database?

 

Otherwise what is the safe SQL command to change the database prefix?

 

 

Is the following bash script correct and complete to apply on the dumped the sql database?

 

#!/bin/sh
#
# Simple script for setting table prefixes in SQL-dump
if [ $# != 2 ]; then
cat >&2 << EOH

Usage:
$0 prefix original_db.sql >prefixed_db.sql
- all tables will prefixed with 'prefix'
EOH
exit 1;
fi
PRFX=$1;
sed "s/^CREATE TABLE /CREATE TABLE $PRFX/i;
s/^INSERT INTO /INSERT INTO $PRFX/i;
s/^REPLACE /REPLACE $PRFX/i;
s/^ALTER TABLE /ALTER TABLE $PRFX/i" $2

 

Beside of modifying config/settings.inc.php, any other files to change?

Link to comment
Share on other sites

But there are lots of tables, need much of work of renaming...

 

First nothing make a full backup Of you site.

 

You can change right there and afrer need type the New prefix in file config/settings.inc.php

Link to comment
Share on other sites

But there are lots of tables, need much of work of renaming...

Do this in your back office, exactly where you mentioned,

Could we do this from Back Office->Preference->Database?

and just do not forget to backup your database before, very important,

Link to comment
Share on other sites

Do this in your back office, exactly where you mentioned,

 

and just do not forget to backup your database before, very important,

 

I tried, but it seems not working. It only changes the database prefix in file config/settings.inc.php

Link to comment
Share on other sites

 

 

I tried, but it seems not working. It only changes the database prefix in file config/settings.inc.php

I think you need check all tables below, try again, if dont work maybe i can help u with some srcipt to change the prefix

Link to comment
Share on other sites

×
×
  • Create New...