Skip to content

Instantly share code, notes, and snippets.

@gjedeer
Created August 22, 2012 06:14
Show Gist options
  • Save gjedeer/3422797 to your computer and use it in GitHub Desktop.
Save gjedeer/3422797 to your computer and use it in GitHub Desktop.
Mass-change database prefixes in Joomla!
#!/bin/bash
#
# mass change prefixes in Joomla database
# massivescale.net 2012
#
echo "SELECT concat('rename table ', table_name, ' to ', 'iddqd', substr(table_name,4), ';') FROM information_schema.tables WHERE table_name like 'jos%';" | mysql | tail -n +2 | mysql `grep db\ /var/www/configuration.php | awk -F"'" '{print $2}'`
sed -i -e 's/jos_/iddqd_/' /var/www/configuration.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment