How to Export MySQL Tables to a file from command line - onlinetutorialspoint

PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
Here we will see how to Export MySQL tables to a file from command line.
mysqldump command helps us to export MySQL tables to a file.
$ mysqldump -u [mysql_user] -p database_name > [file_path]fimename.sql
$ mysqldump -u root -p otp > schema.sql
It asks you to enter the MySQL password, after successful authentication, it will export all the tables schema and data of otp database to a schema.sql file.
If you wanted to export only table schemas without data so that you can use –no-data option.
$ mysqldump -u root -p --no-data otp > schema.sql
It is also possible to export table data without table schema, using –no-create-info option.
$ mysqldump -u root -p --no-create-info otp > schema.sql
We can ship the selected tables into a file.
$ mysqldump -u root -p otp t1,t2,t3.. > schema.sql
$ mysqldump -u root -p otp department,employee > schema3.sql
We can even overlook some of the tables while exporting entire schema into a single file using  –ignore-table.
$ mysqldump -u root -p --ignore-table=otp.employee otp > schema.sql
The above command exports all the database tables except the employee table under the otp database into the schema.sql file.
You can invoke mysqldump locally against a remote server, for this the only thing you have to know remote server host address.
$ mysqldump -h hostname_of_the_server -u root -p otp > schema.sql
mysqldump reference
Happy Learning 🙂

Insert an Image using JDBC in Mysql DB
Java 8 Read File Line By Line Example
How to install Maven on windows 7 command line
Install Mysql on Windows 10 Step by Step
JDBC Connection with Properties file
Java How to create Jar File ?
count number of lines characters and words in a file Java
How to Read CSV File in Python
Hibernate 4 Example with Annotations Mysql
How to Convert Python List Of Objects to CSV File
How to connect MySQL Database in Eclipse
MySQL Create Table Syntax Example
MySQL Unique Constraint Syntax Example
Spring Boot JdbcTemplate CRUD Operations Mysql
Spring Boot Security MySQL Database Integration Example

Insert an Image using JDBC in Mysql DB
Java 8 Read File Line By Line Example
How to install Maven on windows 7 command line
Install Mysql on Windows 10 Step by Step
JDBC Connection with Properties file
Java How to create Jar File ?
count number of lines characters and words in a file Java
How to Read CSV File in Python
Hibernate 4 Example with Annotations Mysql
How to Convert Python List Of Objects to CSV File
How to connect MySQL Database in Eclipse
MySQL Create Table Syntax Example
MySQL Unique Constraint Syntax Example
Spring Boot JdbcTemplate CRUD Operations Mysql
Spring Boot Security MySQL Database Integration Example
 


Δ
 Install Java on Mac OS
 Install AWS CLI on Windows
 Install Minikube on Windows
 Install Docker Toolbox on Windows
 Install SOAPUI on Windows
 Install Gradle on Windows
 Install RabbitMQ on Windows
 Install PuTTY on windows
 Install Mysql on Windows
 Install Hibernate Tools in Eclipse
 Install Elasticsearch on Windows
 Install Maven on Windows
 Install Maven on Ubuntu
 Install Maven on Windows Command
 Add OJDBC jar to Maven Repository
 Install Ant on Windows
 Install RabbitMQ on Windows
 Install Apache Kafka on Ubuntu
 Install Apache Kafka on Windows