In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you the relevant knowledge points about how mysql modifies the table prefix. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
In mysql, you can use the "ALTER TABLE" statement to modify the table prefix, modify the table prefix can be regarded as modifying the table name, use RENAME to modify the table name, the syntax is "ALTER TABLE original table name RENAME TO new table name;"
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to modify the table prefix by mysql
Modify the prefix name of the mysql database table using the SQL statement
The first thing we think of is to use the sql query statement to modify, this method is also very convenient, in the run SQL query box, enter the following language name on it.
ALTER TABLE original table name RENAME TO new table name
Such as:
ALTER TABLE old_post RENAME TO new_post
Sql query statement has a disadvantage, that is, a SQL statement can only change the name of a database table, if you want to modify a table precisely, it is very useful. If there are a lot of tables in the database, it's troublesome.
But we can generate all the sql statements at once with one statement:
Select concat ('alter table', table_name,' rename to', table_name) from information_schema.tables where table_name like'dmsck_%'
The generated statement is as follows:
Alter table dmsck_acategory rename to dmsck_acategory;alter table dmsck_address rename to dmsck_address;alter table dmsck_article rename to dmsck_article;alter table dmsck_attrcategory rename to dmsck_attrcategory;alter table dmsck_attribute rename to dmsck_attribute;alter table dmsck_brand rename to dmsck_brand;alter table dmsck_cart rename to dmsck_cart;alter table dmsck_category_attr rename to dmsck_category_attr;alter table dmsck_category_goods rename to dmsck_category_goods;alter table dmsck_category_store rename to dmsck_category_store Alter table dmsck_collect rename to dmsck_collect;alter table dmsck_comment rename to dmsck_comment;alter table dmsck_coupon rename to dmsck_coupon;alter table dmsck_coupon_sn rename to dmsck_coupon_sn;alter table dmsck_enterprise rename to dmsck_enterprise;alter table dmsck_filmstrip rename to dmsck_filmstrip;alter table dmsck_friend rename to dmsck_friend;alter table dmsck_function rename to dmsck_function;alter table dmsck_gattribute_rule rename to dmsck_gattribute_rule;alter table dmsck_gcategory rename to dmsck_gcategory;alter table dmsck_goods rename to dmsck_goods Alter table dmsck_goods_attr rename to dmsck_goods_attr;alter table dmsck_goods_bak rename to dmsck_goods_bak;alter table dmsck_goods_down_log rename to dmsck_goods_down_log;alter table dmsck_goods_image rename to dmsck_goods_image;alter table dmsck_goods_old rename to dmsck_goods_old;alter table dmsck_goods_qa rename to dmsck_goods_qa;alter table dmsck_goods_spec rename to dmsck_goods_spec;alter table dmsck_goods_statistics rename to dmsck_goods_statistics Alter table dmsck_groupbuy rename to dmsck_groupbuy;alter table dmsck_groupbuy_log rename to dmsck_groupbuy_log;alter table dmsck_keyword rename to dmsck_keyword;alter table dmsck_mail_queue rename to dmsck_mail_queue;alter table dmsck_member rename to dmsck_member;alter table dmsck_message rename to dmsck_message;alter table dmsck_module rename to dmsck_module
Then copy it into a text file, modify the prefix to be modified uniformly (slightly troublesome), and then copy it to mysql to execute the sql statement on ok.
These are all the contents of the article "how to modify table prefixes in mysql". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.