1...Make change.php file with following code and changes according to your new prefix:
----------------------------------------------------------------------------------------
<?php
$db_server = "localhost" ;
$db_name = "type dabase name here";
$db_username = "type dabase username here";
$db_password = "type database password here";
$old_pattern = "jos_" ;
$new_pattern = "type new prefix here_" ;
$session_id = mysql_connect( $db_server, $db_username, $db_password);
if (!$session_id) { die('Connection Failed: ' . mysql_error());}
$query = "SHOW TABLES FROM `" . $db_name . "`" . " LIKE '%" . $old_pattern . "%'";
$result = mysql_query ( $query, $session_id );
if (!$result) {die("Query Failed: " . mysql_error( $session_id ));}
while ( $row = mysql_fetch_array ($result) ) {
$old_table_name = $row[0];
$new_table_name = str_replace ($old_pattern, $new_pattern, $old_table_name);
$query = "RENAME TABLE `".$db_name."`.`".$old_table_name."`"." TO `".$db_name."`.`".$new_table_name."`";
if (mysql_query ( $query, $session_id )) {
echo "$old_table_name renamed to $new_table_name <br />";
} else {
echo "Error: $old_table_name not renamed" . mysql_error( $session_id ) . "<br />";
}
}
mysql_close( $session_id );
?>
------------------------------------------------------------------------------------------
2...Open this file into the browser
3...Go to configuration.php file and change
var $dbprefix = 'new prefix_';
You are done.......:)
----------------------------------------------------------------------------------------
<?php
$db_server = "localhost" ;
$db_name = "type dabase name here";
$db_username = "type dabase username here";
$db_password = "type database password here";
$old_pattern = "jos_" ;
$new_pattern = "type new prefix here_" ;
$session_id = mysql_connect( $db_server, $db_username, $db_password);
if (!$session_id) { die('Connection Failed: ' . mysql_error());}
$query = "SHOW TABLES FROM `" . $db_name . "`" . " LIKE '%" . $old_pattern . "%'";
$result = mysql_query ( $query, $session_id );
if (!$result) {die("Query Failed: " . mysql_error( $session_id ));}
while ( $row = mysql_fetch_array ($result) ) {
$old_table_name = $row[0];
$new_table_name = str_replace ($old_pattern, $new_pattern, $old_table_name);
$query = "RENAME TABLE `".$db_name."`.`".$old_table_name."`"." TO `".$db_name."`.`".$new_table_name."`";
if (mysql_query ( $query, $session_id )) {
echo "$old_table_name renamed to $new_table_name <br />";
} else {
echo "Error: $old_table_name not renamed" . mysql_error( $session_id ) . "<br />";
}
}
mysql_close( $session_id );
?>
------------------------------------------------------------------------------------------
2...Open this file into the browser
3...Go to configuration.php file and change
var $dbprefix = 'new prefix_';
You are done.......:)