当前位置:网站首页>Exporting data using mysqldump
Exporting data using mysqldump
2022-06-11 14:57:00 【Ant】
Use mysqldump Derived data
How to modify mysql Database name
The database name needs to be
old_dbI want to change my name tonew_db
- MySQL It is troublesome to modify the database name , Direct modification is not supported , You need to modify the database name indirectly through other ways .
- stay MySQL 5.1.23 In previous versions , We can use
RENAME DATABASETo rename the database , But later versions , Because of safety considerations , Delete this command .
Export data first , Reimport data
When the database volume is small , The fastest way is to use mysqldump Command to create a rollover copy of the entire database , And then create a new database , Then import the copy into the new database .
Create the database first
create database new_db;
Use mysqldump Derived data
mysqldump -uroot -p123456 --set-gtid-purged=OFF old_db > /tmp/old_db.sql
Only for ordinary local backup and recovery , You can add --set-gtid-purged=OFF Parameters , The function is not to appear during backup GTID Information .
Import data into a new library
mysql -uroot -p123456 new_db < /tmp/old_db.sql
Use mysqldump Export and import data
Export the entire data
mysqldump -u user name -p Database name > Exported file name mysqldump -u dbuser -p dbname > dbname.sql
Export a table
mysqldump -u user name -p Database name Table name > Exported file name mysqldump -u dbuser -p dbname users> dbname_users.sql
Export a database structure
mysqldump -u dbuser -p -d --add-drop-table dbname >d:/dbname_db.sql
-d No data --add-drop-table At every create Add a... Before the statement drop table.
Import database
Commonly used source Order to enter mysql Database console , Such as
> mysql -uroot -proot > use database
And then use source command , The following parameters are script files ( As used here .sql),source d:/dbname.sql.
stay docker In the operation
use root The user enters the container :
docker exec -it -u root containerId bash
Use the above... After entering the container mysql Relevant instructions can be operated .
Export from container to local computer
sudo docker cp feb39d3faffb:/etc/bash.bashrc ~/Downloads
Or vice versa
sudo docker cp /tmp/index.html feb39d3faffb:/etc/
Sharing plans
Blog content will be synchronized to Tencent cloud + Community , Invite everyone to join us :https://cloud.tencent.com/
license agreement
In this paper A signature - Noncommercial use - Share in the same way 4.0 The international license agreement , Reprint please indicate the source .
边栏推荐
- 浙江大学搞出了一款无人机,自动规避障碍,像鸟一样穿过树林,真正的蜂群来了...
- Global and China dynamic light scattering nano laser particle sizer market depth research and Analysis Report
- Riskscanner of multi Cloud Security compliance scanning platform
- 深度剖析「圈组」关系系统设计 | 「圈组」技术系列文章
- Hashicopy之nomad应用编排方案04(伸缩及更新一个Job)
- Task manager based on Qt development
- safePoint讲解及其安插思路分析
- Raspberry pie obtains the function of network installation system without the help of other devices
- A former employee of Baidu was awarded 1.07 million yuan for job hopping; Apple, Google and Microsoft plan to "kill" the password; It is said that Geely has acquired Meizu | Q information
- Seven parameters of thread pool and reject policy
猜你喜欢

Elk log analysis system

Implementation of gray-scale publishing scheme for microservice architecture based on gateway and Nacos

Analyse approfondie de la conception du système relationnel du Groupe de cercles

深度剖析「圈組」關系系統設計 | 「圈組」技術系列文章

19. 二叉搜索树的插入删除修剪

思科瑞递交科创板注册:拟募资6亿 年营收2.22亿

Task manager based on Qt development

Simple C language address book

MySQL create table error 1067 - invalid default value for 'update_ time‘

简单的C语言版本通讯录
随机推荐
High number_ Chapter 6 infinite series__ Marklaurin series
回溯法/活动安排 最大兼容活动
如何做好自媒体?这几个步骤你做对了吗?
In depth research and analysis report on global and Chinese liquid malt extract products market
C language simple webserver
深度解读:分布式系统韧性架构压舱石OpenChaos
Anaconda delete virtual environment
老虎国际季报图解:营收5263万美元 持续国际化布局
In depth research and analysis report on global and Chinese gas monitor market
百度某离职员工跳槽字节被判赔107万元;苹果谷歌微软拟“干掉”密码;传吉利已收购魅族|Q资讯
NVIDIA R & D director: how does AI improve chip design?
2022年湖南省安全员-C证考试练习题及在线模拟考试
Flutter 3.0正式发布:稳定支持6大平台,字节跳动是主要用户
大道至简 | 设计 ViT 到底怎么配置Self-Attention才是最合理的?
Dynamically set the layoutinflater of the layout
Zhejiang University has developed a UAV, which can automatically avoid obstacles and walk through the woods like a bird. The real swarm is coming
System. out. What should I pay attention to when using the println () method
Backtracking / solution space tree permutation tree
在微服务架构中管理技术债务
01Tekton 初探