扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
方法/步骤
成都创新互联专注于普兰店网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供普兰店营销型网站建设,普兰店网站制作、普兰店网页设计、普兰店网站官网定制、微信小程序开发服务,打造普兰店网络公司原创品牌,更为您提供普兰店网站排名全网营销落地服务。
命令行登陆MySQL,进入相应的数据库,本例是shopping(注:用其他工具也可以,比如Navicat for MySQL)。
输入查询表语句查看有哪些表:
select table_name FROM information_schema.tables;
查询结果有许多表,以shopping开头的是我自己建立的,其他的是数据库系统自己建立的。
输入下面语句,查询以shopping开头的数据表:
select table_name FROM information_schema.tables where table_name like 'shopping_%';
输入下面语句:
Select CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO buy_', substring(table_name,9 ),';' )FROM information_schema.tablesWhere table_name LIKE 'shopping_%';
注意:9表示从“shopping_”后面开始
拷贝出以alter开头的所有语句,用Navicat for MySQL工具更直观。
ALTER TABLE shopping__admin RENAME TO buy___admin;ALTER TABLE shopping__adminlog RENAME TO buy___adminlog;ALTER TABLE shopping__article RENAME TO buy___article;ALTER TABLE shopping__basket RENAME TO buy___basket;ALTER TABLE shopping__book RENAME TO buy___book;ALTER TABLE shopping__comment RENAME TO buy___comment;ALTER TABLE shopping__gb RENAME TO buy___gb;ALTER TABLE shopping__gou RENAME TO buy___gou;ALTER TABLE shopping__huo RENAME TO buy___huo;ALTER TABLE shopping__hw RENAME TO buy___hw;ALTER TABLE shopping__logo RENAME TO buy___logo;ALTER TABLE shopping__newsnsort RENAME TO buy___newsnsort;ALTER TABLE shopping__newssort RENAME TO buy___newssort;ALTER TABLE shopping__nsort RENAME TO buy___nsort;ALTER TABLE shopping__pay RENAME TO buy___pay;ALTER TABLE shopping__payonline RENAME TO buy___payonline;ALTER TABLE shopping__pinpai RENAME TO buy___pinpai;ALTER TABLE shopping__ps RENAME TO buy___ps;ALTER TABLE shopping__pub RENAME TO buy___pub;ALTER TABLE shopping__quan RENAME TO buy___quan;ALTER TABLE shopping__rep RENAME TO buy___rep;ALTER TABLE shopping__rule RENAME TO buy___rule;ALTER TABLE shopping__search RENAME TO buy___search;ALTER TABLE shopping__sort RENAME TO buy___sort;ALTER TABLE shopping__sub RENAME TO buy___sub;ALTER TABLE shopping__system RENAME TO buy___system;ALTER TABLE shopping__totime RENAME TO buy___totime;ALTER TABLE shopping__type RENAME TO buy___type;ALTER TABLE shopping__user RENAME TO buy___user;ALTER TABLE shopping__usertype RENAME TO buy___usertype;ALTER TABLE shopping__wrzcnet_ad RENAME TO buy___wrzcnet_ad;ALTER TABLE shopping__wrzcnet_link RENAME TO buy___wrzcnet_link;ALTER TABLE shopping__zp RENAME TO buy___zp;
运行拷贝的语句:
执行完后,在用上面的查询语句查询一下:
select table_name FROM information_schema.tables where table_name like 'shopping_%';
发现没有数据,说明修改成功;修改查询语句:
select table_name FROM information_schema.tables where table_name like 'buy_%';
没什么意思,就是一个变量名表示表的前缀
一般MySQL里面都在在表前面添加一个前缀来区分表的作用。
就是像FI项目用user表,就写成FI_user
所以在有些系统中mysql_table_prefix=FI
你是说的是echsop?还是dedecms
如果只是单纯的表,重命名就可以了
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流