When multiple websites share a mysql database,In order to make the database management not chaotic,Generally, different websites use different prefix names to distinguish them.And how to batch modify the prefix names of existing databases?Export all changes before importing?Or table-by-table modification?Today I want to introduce a relatively simple method to modify the table prefix in the database.It is suitable for modifying the same prefix in the database and many data tables.
This example assumes that the modification is named "www_sdck_cn"in the database with the prefix"phpcms_"table and modify the prefix of all qualifying tables to"sdck_".
1. Use phpmyadmin to open the database www_sdck_cn whose prefix i want to modify, and execute the following SQL statement (where bold italics need to be replaced according to actual needs):
select concat ("alter table", table_name, "rename to", replace (table_name, "phpcms_","sdck_"),";")
where table_schema="www_sdck_cn"and table_name like"phpcms_%";
2. Click "Export" on the page generated by executing the SQL statement, select "Custom"->"Display directly as text", csv format, clear the "content separator" is empty
3. After executing the export function,The result window is as follows,Copy the contents of the text box
4. Enter the database "www_sdck_cn"SQL execution window,Paste the code into the sql text box,carried out. See if the relevant data sheet has been modified.
Data manipulation is risky,Please back up your data before proceeding.
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- dart - flutter: the instance member'stars' can't be accessed in an initializer error