"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  >  Article  >  Database  >  How to modify the table prefix in phpmyadmin

How to modify the table prefix in phpmyadmin

藏色散人
藏色散人Original
2020-04-01 09:56:042563browse

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_%';

How to modify the table prefix in phpmyadmin

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

How to modify the table prefix in phpmyadmin

3. After executing the export function, you will reach the result window as shown below. Copy the content in the text box

How to modify the table prefix in phpmyadmin

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.

How to modify the table prefix in phpmyadmin

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn