Skip to Content
Dismiss
Innovation
A platform built for AI

Unified, automated, and ready to turn data into intelligence.

Find Out How
Dismiss
June 16-18, Las Vegas
Pure//Accelerate® 2026

Discover how to unlock the true value of your data. 

Register Now
Dismiss
NVIDIA GTC San Jose 2026
Experience the Everpure difference at GTC

March 16-19 | Booth #935
San Jose McEnery Convention Center

Schedule a Meeting

What Is mysqldump?

What Is mysqldump?

Database administrators and system administrators must take backups of their MySQL database, and the mysqldump utility is the most common tool used to convert an entire database or single object to a text file. After the mysqldump utility creates a backup file, it can be used to restore data to a server or migrate data to another database.

What Is mysqldump?

The mysqldump tool is a command-line utility included with MySQLto use for exporting SQL statements that can rebuild a database or a subset of objects in a database. It can be used to create a backup of database objects and data, or it can be used to transfer a database from one server to another. Administrators can use mysqldump to export data into a specific format such as XML and CSV.

How to use mysqldump to backup a single table

The mysqldump utility can be used to export only specific tables within a database. For example, suppose that you only want to export a single customer table from an e-commerce database. The customer table data can then be used to send marketing emails. The mysqldump utility will export the customer table and its data to a text file.

Note: To successfully run any command in mysqldump, the username used to access the database must have the appropriate permissions to access objects. Without access, the command will not export any schema, object, or data.

You must specify the database name and the table name to successfully export objects to a text file. If you want to verify that you have the right table name, first make sure you’re authenticated into the database that you want to work with. Then, run the following SQL command in the MySQL command line or the Workbench application:

SHOW TABLES;

After you find the right table name, you can export the table to a text file. The following command will export the Customer table from the database myDB to the file customers.sql:

mysqldump -u username -p password myDB Customer > customers.sql

The “username” and “password” terms should be swapped with your own username and password. You can export multiple tables by separating each table with a space character. The following will export the Customer and Order tables to customers_orders.sql:

mysqldump -u username -p password myDB Customer Order > customers_orders.sql

After you export the SQL statements to a file, you can open the SQL file with a standard text editor or open it with MySQL Workbench. MySQL Workbench is a separate installation from the MySQL database, but you can download it for free from the MySQL website. It’s best to open it with Workbench because then you can run the statements and import data to the target MySQL database server.

mysqldump Examples

The mysqldump utility is mainly used for backups or transferring data to another database server. Whether you take a backup of your database or want to transfer data to another server, the mysqldump utility works the same. One common use for a mysqldump backup is to create a test environment from the production database.

To use a production database to then create a testing environment, you can take a full backup of your database using the mysqldump utility. The following command takes a backup of your entire database named myDB and exports it to a file named myDB.sql:

mysqldump -u username -p password -databases myDB > myDB.sql

Now, log in to your testing server. It must also have MySQL installed so that you can import the exported data. Notice that the export command uses the ‘>’ character to move data from a database to a SQL file. The import process uses the ‘<’ character. The following command imports all data in the myDB.sql file to a test environment with the same database named myDB:

mysqldump -u username -p password -databases myDB < myDB.sql

With the above two commands, you replicate data from the original myDB database in production to your test environment. The test environment gives developers and quality assurance people the ability to work with real-world data and a database structure that mimics any customer or employee issues for troubleshooting.

Basic Use of mysqldump

The .sql file created during a mysqldump is a simple text file. You can open it in any text editor, but it’s best to open it with MySQL Workbench. Workbench color codes commands and data types, which makes the SQL commands easier to read.

You can open the .sql file in Workbench using the File menu. Click “Open SQL Script” in the dialog box and choose the .sql file that you want to read. With the .sql file opened, you can read it and run it with the “Run SQL Script” File menu item, if you choose to execute the commands. Workbench runs on Windows and Linux, so you can run a script this way on both operating systems.

You can also run a mysqldump file in Windows and Linux using the mysqldump utility. The following command runs the SQL statements on a MySQL database in both Windows and Linux from the mysqldump utility:

mysqldump -u username -p password -databases myDB < myDB.sql

The above command imports data from the myDB.sql mysqldump file and executes the SQL statements on the local database server. The command imports data to the myDB database.

If no data is present in the database or any of the database’s tables, the database structures are still created, and the database is added to the schema. The table structures are available for you to add data to them in the future.

Advanced Use of mysqldump

A large database could contain tables with terabytes of data. Too many exports could exhaust storage resources, but you can compress each file to reduce storage space needed for MySQL data exports. Compressing a file can save multiple gigabytes of storage space necessary for very large files. The following mysqldump command exports the myDB database and compresses it using the gzip utility to a file named myDB.sql.gz:

mysqldump -u username -p password -databases myDB | gzip myDB.sql.gz

Backups often contain sensitive data, so encrypting it is necessary for compliance and data protection. You need a third-party tool to encrypt data. We’ll use ccrypt in this example to encrypt the myDB.sql file. You need a key (similar to a passphrase) to encrypt a file, but you must remember this key to decrypt it. The ccrypt utility will prompt you to enter a key when you encrypt the file, or you can store a key in a secure file where it can be reused to encrypt and decrypt a .sql file.

In the following example, the exported .sql file is encrypted using a stored key in the file named mykey.key:

mysqldump -u username -p password -databases myDB | ccrypt -k mykey.key > myDB.sql.cpt

Notice that the data is exported to a .cpt file. This .cpt file is where all the encrypted data is stored. You need the same key to decrypt the file. You can decrypt it using the following command:

cdecrypt -k mykey.key myDB.sql.cpt

Most databases contain more than tables and data. Triggers and procedures must also be backed up. By default, the mysqldump utility exports triggers with a standard export, but administrators can explicitly tell the command to export them. Procedures are not exported by default, so administrators must explicitly export them. The following command exports triggers and procedures along with other database objects and data:

mysqldump -u username -p password -databases myDB –triggers=true –routines=true > myDB.sql

Best Practices for mysqldump

Anytime you need to use the mysqldump utility, you can freely use it without interrupting productivity. It’s especially useful when you need to make frequent backups or exports of your database and its data. Backups should be done often so that data can be retrieved in case of database failure, malware, or data corruption.

The frequency of backups depends on the amount of data you add to a database every day and the frequency of changes made to the database. Generally, the frequency at which you use the mysqldump command depends on the amount of data that can be lost without causing a negative impact on revenue and business continuity. You don’t always need a full backup, but some businesses use the mysqldump utility once a week and others use it once a day. Determine the frequency of full backups necessary for your business and use automation tools to execute mysqldump at a set interval. 

Conclusion

Managing a database is a full-time job, but the mysqldump utility makes management much more efficient. You can use it for full backups of your data or use it to transfer data between servers. It’s compatible with Windows or Linux, so you can use it on any environment hosting your MySQL server.

09/2025
Azure VMware Storage - Cut AVS Costs by 40% | Everpure
Reduce Azure VMware Solution costs by 40% with independently scalable storage. Enterprise-grade block storage managed directly from Azure portal.
Solution Brief
5 pages

Browse key resources and events

TRADESHOW
Pure//Accelerate® 2026
June 16-18, 2026 | Resorts World Las Vegas

Get ready for the most valuable event you’ll attend this year.

Register Now
PURE360 DEMOS
Explore, learn, and experience Everpure.

Access on-demand videos and demos to see what Everpure can do.

Watch Demos
VIDEO
Watch: The value of an Enterprise Data Cloud

Charlie Giancarlo on why managing data—not storage—is the future. Discover how a unified approach transforms enterprise IT operations.

Watch Now
RESOURCE
Legacy storage can’t power the future

Modern workloads demand AI-ready speed, security, and scale. Is your stack ready?

Take the Assessment
Your Browser Is No Longer Supported!

Older browsers often represent security risks. In order to deliver the best possible experience when using our site, please update to any of these latest browsers.

Personalize for Me
Steps Complete!
1
2
3
Personalize your Everpure experience
Select a challenge, or skip and build your own use case.
Future-proof virtualization strategies

Storage options for all your needs

Enable AI projects at any scale

High-performance storage for data pipelines, training, and inferencing

Protect against data loss

Cyber resilience solutions that defend your data

Reduce cost of cloud operations

Cost-efficient storage for Azure, AWS, and private clouds

Accelerate applications and database performance

Low-latency storage for application performance

Reduce data center power and space usage

Resource efficient storage to improve data center utilization

Confirm your outcome priorities
Your scenario prioritizes the selected outcomes. You can modify or choose next to confirm.
Primary
Reduce My Storage Costs
Lower hardware and operational spend.
Primary
Strengthen Cyber Resilience
Detect, protect against, and recover from ransomware.
Primary
Simplify Governance and Compliance
Easy-to-use policy rules, settings, and templates.
Primary
Deliver Workflow Automation
Eliminate error-prone manual tasks.
Primary
Use Less Power and Space
Smaller footprint, lower power consumption.
Primary
Boost Performance and Scale
Predictability and low latency at any size.
What’s your role and industry?
We've inferred your role based on your scenario. Modify or confirm and select your industry.
Select your industry
Financial services
Government
Healthcare
Education
Telecommunications
Automotive
Hyperscaler
Electronic design automation
Retail
Service provider
Transportation
Which team are you on?
Technical leadership team
Defines the strategy and the decision making process
Infrastructure and Ops team
Manages IT infrastructure operations and the technical evaluations
Business leadership team
Responsible for achieving business outcomes
Security team
Owns the policies for security, incident management, and recovery
Application team
Owns the business applications and application SLAs
Describe your ideal environment
Tell us about your infrastructure and workload needs. We chose a few based on your scenario.
Select your preferred deployment
Hosted
Dedicated off-prem
On-prem
Your data center + edge
Public cloud
Public cloud only
Hybrid
Mix of on-prem and cloud
Select the workloads you need
Databases
Oracle, SQL Server, SAP HANA, open-source

Key benefits:

  • Instant, space-efficient snapshots

  • Near-zero-RPO protection and rapid restore

  • Consistent, low-latency performance

 

AI/ML and analytics
Training, inference, data lakes, HPC

Key benefits:

  • Predictable throughput for faster training and ingest

  • One data layer for pipelines from ingest to serve

  • Optimized GPU utilization and scale
Data protection and recovery
Backups, disaster recovery, and ransomware-safe restore

Key benefits:

  • Immutable snapshots and isolated recovery points

  • Clean, rapid restore with SafeMode™

  • Detection and policy-driven response

 

Containers and Kubernetes
Kubernetes, containers, microservices

Key benefits:

  • Reliable, persistent volumes for stateful apps

  • Fast, space-efficient clones for CI/CD

  • Multi-cloud portability and consistent ops
Cloud
AWS, Azure

Key benefits:

  • Consistent data services across clouds

  • Simple mobility for apps and datasets

  • Flexible, pay-as-you-use economics

 

Virtualization
VMs, vSphere, VCF, vSAN replacement

Key benefits:

  • Higher VM density with predictable latency

  • Non-disruptive, always-on upgrades

  • Fast ransomware recovery with SafeMode™

 

Data storage
Block, file, and object

Key benefits:

  • Consolidate workloads on one platform

  • Unified services, policy, and governance

  • Eliminate silos and redundant copies

 

What other vendors are you considering or using?
Thinking...
Your personalized, guided path
Get started with resources based on your selections.