当前位置:网站首页>MySQL command line import and export data
MySQL command line import and export data
2022-06-10 23:55:00 【Li_ XiaoJin】
In refactoring the system , The original system used MySQL, Now we need to change to PostgreSQL, So you need to migrate the data . The current plan is to export the records of the production database , Import to a backup Library of the test environment , Then the program will convert the data into a new PostgreSQL database , Therefore, the production database export is involved , Because the production database cannot be used Navicat Other software connections , So you can only export from the command line , Make a note of .
export
This step does not require logging into the database , Use it directly mysqldumpl Command to export .
Export the entire library
mysqldump -u user name -p Database name > Exported file name
mysqldump -u root -p --databases db_name > test_db.sql
Export a table
mysqldump -u user name -p Database name Table name > Exported file name
Only export the database structure , Without data
mysqldump -u user name -p -d Database name > Exported file name
-d : Just back up the structure , Don't back up data . You can also use ”–no-data” Instead of ”-d”, The effect is the same .
example :
If appear -bash: mysqldump: command not found The error of , The processing is as follows :
find MySQL Installation path for ,
find / -name mysql -print
stay /usr/bin Create under directory mysqldump The soft links
My installation path here is /usr/local/mysql/bin/mysqldump ,
Carry out orders ln -fs /usr/local/mysql/bin/mysqldump /usr/bin/
After execution, you can use mysqldump The command .
Import
- Get into MySQL:mysql -u user name -p
- Create a new database , Or go to the database where you want to import data
Input :mysql>create database The name of the database to be created ;
Or input :mysql>use Database name to use ;
- Import files , Use source Command to import the file
Enter the command line :mysql>source / File path / file name .sql;
Today is the launch day of Shenzhou 12 , I wish Shenzhou 12 every success ! The three astronauts returned safely and triumphantly ! Pay tribute to China's Aerospace !
Hired Heroes , Breaking through the clouds and the sun !
End.
Copyright: use Creative Commons signature 4.0 International license agreement to license Links:https://lixj.fun/archives/mysql Command line export data
边栏推荐
- curl导入postman报错小记
- 都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
- [mathematics] [continuum mechanics] symmetry tensor, strain tensor and stress tensor in fluid mechanics
- [latex] latex vs Code Snippets
- LabVIEW open other exe programs
- 判等问题:如何确定程序的判断是正确的?
- Is it safe for CICC Fortune Securities to open an account? Is it reliable?
- Ilruntime hotfix framework installation and breakpoint debugging
- 【Pygame小游戏】激荡大脑思维,一起来玩转奇思妙想“24点”叭~(超赞滴)
- LabVIEW displays the time and date on the waveform chart or waveform chart
猜你喜欢

黑马头条丨腾讯薪酬制度改革引争议;英特尔全国扩招女工程师;黑马100%就业真的吗......

LabVIEW图片在从16位强制转换为8位后看起来要亮或暗

示波器和频谱分析仪的区别

Hyperleger fabric installation

VS的常用设置

LeetCode 501 :二叉搜索树中的众数

Fiddler simulates low-speed network environment

LabVIEW open other exe programs

How to generate automatic references (simple drawings)

【数学】【连续介质力学】流体力学中的对称张量、应变张量和应力张量
随机推荐
Data and information resource sharing platform (6)
What Fiddler does for testing
LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行
The data file insurance CSV contains 1338 observations, that is, the registered beneficiaries of the insurance plan and the characteristics that represent the characteristics of patients and the total
R language to draw two-dimensional normal distribution density surface;
LeetCode+ 21 - 25
LabVIEW和VDM提取色彩和生成灰度图像
Vs tomato assistant add header comments and usage
【二叉树】二叉树剪枝
Solve access denied for user 'root' @ 'localhost' (using password: yes)
IGBT与三代半导体SiC双脉冲测试方案
【无标题】
LabVIEW编程规范
【Pygame小游戏】别找了,休闲游戏专题来了丨泡泡龙小程序——休闲游戏研发推荐
怎么生成自动参考文献(简单 有图)
LabVIEW uses the visa read function to read USB interrupt data
LabVIEW或MAX下的VISA测试面板中串口无法工作
LabVIEW programming specification
Fiddler creates an autoresponder
都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。