当前位置:网站首页>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 .
边栏推荐
- Station B executives interpret the financial report: the epidemic has no impact on the company's long-term development, and the video trend is irresistible
- Backtracking / solution space tree permutation tree
- 化“被动”为“主动”,如何构建安全合规的智能产品 | Q推荐
- North China pushed Yale hard, MIT won the first place in a row, and the latest 2023qs world university ranking was released
- Microservices - use of Nacos
- Taking log4j as an example, how to evaluate and classify security risks
- 深度剖析「圈組」關系系統設計 | 「圈組」技術系列文章
- Sum of two leetcode numbers
- In depth research and analysis report on global and Chinese smart lamp Market
- Hamad application layout scheme 02 of hashicopy
猜你喜欢

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

B站高管解读财报:疫情对公司长期发展无影响 视频化趋势不可阻挡

Tencent interviewers share their interview experience, how to evaluate the interviewers' technical and personal comprehensive quality, and give you some suggestions on the interview

Uniapp settings page Jump effect - navigateto switching effect - Global animationtype animation

Cisco Rui submitted the registration of sci tech Innovation Board: proposed to raise 600million yuan, with annual revenue of 222million yuan

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

大道至简 | 设计 ViT 到底怎么配置Self-Attention才是最合理的?

【SystemVerilog 之 接口】~ Interface

Live800: several ways for intelligent customer service to improve customer experience

Elk log analysis system
随机推荐
MySQL create table error 1067 - invalid default value for 'update_ time‘
[process blocks and methods of SystemVerilog] ~ domain, always process block, initial process block, function, task, life cycle
Seven parameters of thread pool and reject policy
Flutter 3.0正式发布:稳定支持6大平台,字节跳动是主要用户
Architectural concept exploration: Taking the development of card games as an example
In depth research and analysis report on global and Chinese content audit market
数字化转型项目做了多年,主架构师都绝望了:当初就不应该用外包!
如何做好自媒体?这几个步骤你做对了吗?
多云安全合规扫描平台之RiskScanner
Individual income tax rate table
PowerShell主架构师:我用业余时间开发项目,表现优秀反而被微软降级了
Turning "passive" into "active", how to build security compliant intelligent products | Q recommendation
Task manager based on Qt development
In depth research and analysis report on global and Chinese smart lamp Market
Tangzhengrong: CTO is the intersection of business thinking and technical thinking
老虎国际季报图解:营收5263万美元 持续国际化布局
Anaconda delete virtual environment
Nexus of repository manager
回溯法/活动安排 最大兼容活动
【Azure 应用服务】NodeJS Express + MSAL 实现API应用Token认证(AAD OAuth2 idToken)的认证实验 -- passport.authenticate()