How to export and import from Linux commands to MySQL

I often forget it, so it's for notes.

Export all the contents of a specific database

Click the following command.

mysqldump -u root -p testdb > dump.sql

In the above example The database name will be the root user, testdb. Output the contents of tesdb with the file name "dump.sql".

After typing the above command, you will be prompted for a password.

Import database sql file specifically

Click the following command.

mysql -u root -p testdb < dump.sql

In the above example The database name will be the root user, testdb. Import the dump.sql file into testdb.

After typing the above command, you will be prompted for a password.

that's all

Recommended Posts

How to export and import from Linux commands to MySQL
How to handle Linux commands well from Python
How to operate Linux from the console
[Python] How to read data from CIFAR-10 and CIFAR-100
How to operate Linux from the outside Procedure
How to switch between Linux and Mac shells
Linux commands to remember
Backtrader How to import an indicator from another file
How to export / import Zope zope object installed with Plone-4.1.5-UnifiedInstaller-20120604.tgz
[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS
How to connect to various DBs from Python (PEP 249) and SQLAlchemy
How to execute external shell scripts and commands in python
Commands and files to check the version of CentOS Linux
How to import CSV and TSV files into SQLite with Python
How to get followers and followers from python using the Mastodon API
How to install VMware-Tools on Linux
How to set up and use OMC Log Analytics --Linux version -
How to install MBDyn (Linux Ubuntu)
How to display PDF resolution and detailed information on Linux (pdfinfo)
About Python, from and import, as
[EC2] How to install and download chromedriver from the command line
How to install and configure blackbird
How to use .bash_profile and .bashrc
How to install and use Graphviz
How to extract the desired character string from a line 4 commands
Send commands from Atom to Maya
How to launch Explorer from WSL
[Linux] File and directory operation commands
How to check and change Linux permissions (permissions) (chmod) (I want to be saved from Permiss on denied)
How to resolve the error from toimage (from PIL.Image import fromarray as toimage)
How to access wikipedia from python
How to convert from .mgz to .nii.gz
How to check Linux OS version
HDA distribution from Houdini to export FBX with hierarchy and transforms
Note: Linux concepts and minimum commands
How to solve slide puzzles and 15 puzzles
[TF] How to use Tensorboard from Keras
How to update php on Amazon linux 2
[Python] How to use import sys sys.argv
How to execute commands in jupyter notebook
Connecting from python to MySQL on CentOS 6.4
How to install packages on Alpine Linux
Porting and modifying doublet-solver from python2 to python3.
How to access RDS from Lambda (python)
Read Python csv and export to txt
Dump SQLite3 data and migrate to MySQL
python: How to use locals () and globals ()
How to install Windows Subsystem For Linux
How to handle consecutive values in MySQL
How to power off Linux with Ultra96-V2
How to update security on CentOS Linux 8
How to install php7.4 on Linux (Ubuntu)
How to create a repository from media
[Python] How to calculate MAE and RMSE
How to use Python zip and enumerate
How to access the Datastore from the outside
Scraping using lxml and saving to MySQL
Introducing Docker Engine to Linux From Scratch
How to find large files on Linux
[Amazon Linux] Switching from Python 2 series to Python 3 series
How to use is and == in Python