【Mysql】改数据库库名操作
发表于:2025-11-06 作者:千家信息网编辑
千家信息网最后更新 2025年11月06日,MySQL在5.1引入了一个rename database操作,但在MySQL5.1.23后又不支持这个命令。可以说是一个实验性的功能,没有在生产中支持过(mysql-5.1 release在mysq
千家信息网最后更新 2025年11月06日【Mysql】改数据库库名操作
[root@host-192-168-1-56 ~]# more /tmp/rename_to_db_v2.sql
rename table test.bc_dbfsxiang to testbak.bc_dbfsxiang;
rename table test.bc_dkfsxiang to testbak.bc_dkfsxiang;
rename table test.bc_dkytxiang to testbak.bc_dkytxiang;
rename table test.bc_gzffxiang to testbak.bc_gzffxiang;
rename table test.bc_option_map to testbak.bc_option_map;
rename table test.bc_qylxxiang to testbak.bc_qylxxiang;
rename table test.bc_service_city to testbak.bc_service_city;
rename table test.bc_service_qi_city to testbak.bc_service_qi_city;
rename table test.bc_wffkhyxiang to testbak.bc_wffkhyxiang;
rename table test.bc_wffkzyxiang to testbak.bc_wffkzyxiang;
rename table test.bc_xindai to testbak.bc_xindai;
rename table test.bc_xindai_fields_v to testbak.bc_xindai_fields_v;
rename table test.bc_xindai_geren to testbak.bc_xindai_geren;
rename table test.bc_xindai_qiye to testbak.bc_xindai_qiye;
rename table test.bc_xyjlxiang to testbak.bc_xyjlxiang;
rename table test.bc_zyyqxiang to testbak.bc_zyyqxiang;
rename table test.fake_names to testbak.fake_names;
rename table test.idmap to testbak.idmap;
rename table test.sbtest to testbak.sbtest;
rename table test.tbUser to testbak.tbUser;
rename table test.test to testbak.test;
rename table test.test2 to testbak.test2;
3 执行即可
原文地址:http://wubx.net/tips-mysql-rename-database/
MySQL在5.1引入了一个rename database操作,但在MySQL5.1.23后又不支持这个命令。可以说是一个实验性的功能,没有在生产中支持过(mysql-5.1 release在mysql-5.1.30),那么生产中我们有时为了追求完美需要改一下库名。怎么操作呢?
这里提供一个变通的方法。
1. 创建出新库名:
此处)折叠或打开
- mysql> select concat("rename table ",table_schema,".",table_name," to testbak.",table_name,";") into outfile '/tmp/rename_to_db_v2.sql' from information_schema.tables where table_schema='test';
[root@host-192-168-1-56 ~]# more /tmp/rename_to_db_v2.sql
rename table test.bc_dbfsxiang to testbak.bc_dbfsxiang;
rename table test.bc_dkfsxiang to testbak.bc_dkfsxiang;
rename table test.bc_dkytxiang to testbak.bc_dkytxiang;
rename table test.bc_gzffxiang to testbak.bc_gzffxiang;
rename table test.bc_option_map to testbak.bc_option_map;
rename table test.bc_qylxxiang to testbak.bc_qylxxiang;
rename table test.bc_service_city to testbak.bc_service_city;
rename table test.bc_service_qi_city to testbak.bc_service_qi_city;
rename table test.bc_wffkhyxiang to testbak.bc_wffkhyxiang;
rename table test.bc_wffkzyxiang to testbak.bc_wffkzyxiang;
rename table test.bc_xindai to testbak.bc_xindai;
rename table test.bc_xindai_fields_v to testbak.bc_xindai_fields_v;
rename table test.bc_xindai_geren to testbak.bc_xindai_geren;
rename table test.bc_xindai_qiye to testbak.bc_xindai_qiye;
rename table test.bc_xyjlxiang to testbak.bc_xyjlxiang;
rename table test.bc_zyyqxiang to testbak.bc_zyyqxiang;
rename table test.fake_names to testbak.fake_names;
rename table test.idmap to testbak.idmap;
rename table test.sbtest to testbak.sbtest;
rename table test.tbUser to testbak.tbUser;
rename table test.test to testbak.test;
rename table test.test2 to testbak.test2;
3 执行即可
点击(此处)折叠或打开
- mysql> source /tmp/rename_to_db_v2.sql;
原文地址:http://wubx.net/tips-mysql-rename-database/
支持
产中
功能
原文
命令
地址
实验性
方法
生产中
说是
变通
实验
生产
数据
数据库
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
2021网络安全龙头股票
工控网络安全最前沿技术
网络安全涉及哪些层面
ATM是一种( )网络技术
朝阳区创新网络技术服务优点
用户可以随便买服务器吗
更改游戏服务器列表连接区IP
软件开发在西安的市场需求
网站开发和网络安全
如何进starbase数据库呀
网络安全国家队出来
数据库设计工具idea
imap服务器怎么开启
做个网络安全系统有前途吗
网络安全专业工资与前景
软件开发时期的三个阶段
招远软件开发外包公司
数据库技术的工作方向
网络安全自查情况报告
阿里云上的服务器如何改登录密码
天津现代化软件开发批发
软件开发引擎系统
winform从数据库获取日期
58同城服务器连接超时
全球顶尖的网络安全实验室
网络安全渗透测试报告机构
服务器自带地址怎么删除
服务器圆柱体指示灯红色
上流系统服务器密码过期
时空数据库实例
- 上一篇
innobackupex:Error:xtrabackup child process has died at /usr/bin/innobackupex
使用innobackupex进行数据库备份,报如下错误:innobackupex --compress --parallel=4 --user=root --password=yoon /export
- 下一篇
数字化企业发展为什么选择SAP?
社会发展到今天,每个人的生活方式,都是通过网络把人与人密切绑定在一起;明天,或许网络会让人与物、物与物之间、企业管理与生产、销售等职能部门更智能地绑定在一起。显然,人还是主角,数据是通途,而SAP则是