"Display directly as text"; then enter the SQL execution window of the database; finally, replace the code "replace(..) "Paste it into the SQL text box and execute it to complete the modification."/> "Display directly as text"; then enter the SQL execution window of the database; finally, replace the code "replace(..) "Paste it into the SQL text box and execute it to complete the modification.">
Home >Database >phpMyAdmin >How to modify the table prefix in phpmyadmin
How does phpmyadmin modify the table prefix?
In this example, it is assumed that the table with the prefix "phpcms_" in the database named "www_sdck_cn" is modified, and the prefix of all tables that meet the conditions is modified to "sdck_".
1. Use phpMyAdmin to open the database www_sdck_cn whose prefix you want to modify, and execute the following SQL statement (the bold and italic words need to be replaced according to actual needs):
Select CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO ', replace(table_name,'phpcms_','sdck_'),';') from information_schema.tables where TABLE_SCHEMA = 'www_sdck_cn' and table_name LIKE 'phpcms_%';
2. Click "Export" on the page generated by executing the SQL statement, select "Customize"->"Display directly as text", CSV format, clear" "Content separator" is empty
3. After executing the export function, you will reach the result window as shown below. Copy the content in the text box
4. Enter the SQL execution window of the database "www_sdck_cn", paste the code into the SQL text box, and execute. Check to see if the relevant data table has been modified.
Notes
Data operations are risky, please back up the data before operation.
The above is the detailed content of How to modify the table prefix in phpmyadmin. For more information, please follow other related articles on the PHP Chinese website!