您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“MySQL中如何快速更改數(shù)據(jù)庫名稱”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“MySQL中如何快速更改數(shù)據(jù)庫名稱”吧!
mysql > create database centos_old;
mysql -uroot -p -e "select concat('rename table centos.',table_name,' to centos_old.',table_name,';') from information_schema.TABLES where TABLE_SCHEMA='centos';" > rename_mysql_name.sql
打開rename_mysql_name.sql,把第一行刪除。
rename_mysql_name.sql內(nèi)容大概為:
rename table centos.wp_commentmeta to centos_old.wp_commentmeta; rename table centos.wp_comments to centos_old.wp_comments; rename table centos.wp_forum_forums to centos_old.wp_forum_forums; rename table centos.wp_forum_groups to centos_old.wp_forum_groups; rename table centos.wp_forum_posts to centos_old.wp_forum_posts; rename table centos.wp_forum_threads to centos_old.wp_forum_threads; rename table centos.wp_forum_usergroup2user to centos_old.wp_forum_usergroup2user; rename table centos.wp_forum_usergroups to centos_old.wp_forum_usergroups; rename table centos.wp_links to centos_old.wp_links; rename table centos.wp_options to centos_old.wp_options; rename table centos.wp_postmeta to centos_old.wp_postmeta; rename table centos.wp_posts to centos_old.wp_posts; rename table centos.wp_term_relationships to centos_old.wp_term_relationships; rename table centos.wp_term_taxonomy to centos_old.wp_term_taxonomy; rename table centos.wp_terms to centos_old.wp_terms; rename table centos.wp_usermeta to centos_old.wp_usermeta; rename table centos.wp_users to centos_old.wp_users;
mysql -uroot -p
這樣就完成了centos數(shù)據(jù)庫名更改為centos_old的操作。
到此,相信大家對“MySQL中如何快速更改數(shù)據(jù)庫名稱”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進入相關(guān)頻道進行查詢,關(guān)注我們,繼續(xù)學習!
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。