PhpMyAdmin batch modification of MySQL Data Table prefixes

Source: Internet
Author: User
When multiple websites share the same MySQL database, different websites use different prefixes to differentiate database management. How to batch modify existing

When multiple websites share the same MySQL database, different websites use different prefixes to differentiate database management. How to batch modify existing

When multiple websites share the same MySQL database, different websites use different prefixes to differentiate database management. How can I modify the prefix names of an existing database in batches? Export all the modifications before importing them? Or a table or a table? Today, I want to introduce a relatively simple method to modify the table prefix in a database in batches. This method is suitable for modifying databases with the same prefix and a large number of data tables.

In this example, modify the table prefixed with "phpcms _" in the database named "www_linuxidc_com" and change the prefix of all qualified tables to "linuxidc _".

1. Use phpMyAdmin to open the database www_linuxidc_com whose prefix is to be modified, and execute the following SQL statement (the bold italic must be replaced according to actual needs ):

Select CONCAT ('alter table', table_name, 'rename TO ', replace (table_name, 'phpcms _', 'linuxidc _'),';')

From information_schema.tables

Where TABLE_SCHEMA = 'www _ linuxidc_com 'and table_name LIKE 'phpcms _ % ';

2. On the SQL statement generation page, click "Export" and choose "Custom"> "display as text directly" to export the txt format.

3. After the export function is executed, the result window is displayed as follows. Copy the content in the text box ------- here, you may need to handle it first due to different versions.

4. Execute the alert statement in txt.

The exported alert statement is similar

Alter table v9_admin rename to yanglao_admin;

Example of LAMP architecture collaborative application-phpMyAdmin

PhpMyAdmin and Wordpress for LAMP applications

PhpMyAdmin logon timeout Solution

Install phpMyAdmin and Adminer in Ubuntu

Implement SSL functions based on LAMP and install phpMyAdmin

Configure the LAMP + phpMyAdmin PHP (5.5.9) development environment in Ubuntu 14.04

PhpMyAdmin details: click here
PhpMyAdmin: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.