Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The basic backup command is mysqldump -u USER -p DATABASE > backup.sql. For an online backup of a database whose important tables use InnoDB, add --single-transaction --quick: mysqldump -u USER -p --single-transaction --quick DATABASE > backup.sql. Enter the password when prompted, check that the command exits successfully, and perform a test restore before relying on the file.

What mysqldump creates

mysqldump makes a logical backup: a text file containing SQL statements that can recreate database objects and insert table data. It is portable and easy to inspect, but restoring means executing those statements again. That makes restore duration dependent on the amount of SQL and the target server’s performance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A successful dump command proves that the export process completed; it does not, by itself, prove that the file is usable. A recovery plan should include a restore test on a separate database or server and should verify that the expected tables, rows, routines, events, views, and triggers are present.

Choose the right command first

One database, standard export

mysqldump -u USER -p DATABASE > backup.sql

Replace USER with the MySQL account and DATABASE with the schema to export. The shell’s > operator writes standard output to backup.sql; it will create the file or replace an existing file with the same name. The password is requested interactively after you press Enter, so it is not placed directly in the command line.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Online export for mostly InnoDB tables

mysqldump -u USER -p --single-transaction --quick DATABASE > backup.sql

--single-transaction starts a transaction at REPEATABLE READ and reads a consistent state of transactional InnoDB tables without blocking applications in the way a table-locking dump can. --quick reads rows a table at a time instead of buffering an entire table, which is recommended with --single-transaction for large tables.

This consistency guarantee applies to transactional tables such as InnoDB. It does not provide the same snapshot behavior for MyISAM or MEMORY tables. If a database mixes storage engines, identify which tables are nontransactional and plan how their consistency will be handled rather than assuming the entire database represents one transactionally consistent instant.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Several databases

mysqldump -u USER -p --databases db1 db2 > backup.sql

--databases (short form -B) tells mysqldump that the arguments are database names. The resulting file includes CREATE DATABASE and USE statements before each database, allowing a reload to create and select those databases when the account has the required privileges.

Include every object your application needs

Tables, views, and triggers

Tables and their data are the central contents of a normal dump. Triggers are included by default. Use --skip-triggers only when you deliberately do not want trigger definitions; omitting them can change application behavior after recovery.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Stored procedures and functions

Add --routines to include stored procedures and stored functions:

mysqldump -u USER -p --single-transaction --quick --routines DATABASE > backup.sql

Event Scheduler events

Add --events when scheduled Event Scheduler definitions are part of the application:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysqldump -u USER -p --single-transaction --quick --events DATABASE > backup.sql

A comprehensive application-database command

mysqldump -u USER -p 
  --single-transaction 
  --quick 
  --routines 
  --events 
  --triggers 
  DATABASE > backup.sql

--triggers is shown explicitly for readability even though triggers are included by default. This form is suitable when the workload is primarily InnoDB and you need routines and events as well as table data.

Dumping all databases on MySQL 8.4

When using --all-databases with MySQL 8.4, explicitly add --routines --events if those definitions must be included. Older releases handled these system definitions differently, so do not infer the behavior of an older server from an 8.4 command or vice versa.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
mysqldump -u USER -p --all-databases --routines --events > all-databases.sql

Use an all-databases dump only when the account and recovery plan are intended to cover every database on the server. For an application backup, naming the required databases makes the scope easier to review.

Step-by-step: create a dependable dump

  1. Identify the server and scope. Confirm the MySQL instance, database names, storage engines, and whether the application uses views, triggers, routines, or events. Decide whether you need one database, several named databases, or all databases.
  2. Prepare an account with suitable privileges. The account generally needs SELECT on dumped tables, SHOW VIEW for views, and TRIGGER for triggers. A dump without --single-transaction generally also needs LOCK TABLES. Tablespace and GTID-related settings can require additional PROCESS, RELOAD, or FLUSH_TABLES privileges.
  3. Choose consistency behavior. For mostly InnoDB tables that must remain online, use --single-transaction --quick. If the database contains MyISAM or MEMORY tables, account for the fact that the transaction snapshot does not guarantee the same consistency for those tables.
  4. Add non-table objects deliberately. Include --routines for procedures and functions and --events for Event Scheduler events. Leave triggers enabled unless there is a specific reason to use --skip-triggers.
  5. Run the command from a location with enough space. The redirected SQL file can be large. Use a destination whose filesystem has room for the complete export and whose permissions restrict access to the people or services that handle backups.
  6. Watch the command’s result. A normal completion returns control to the shell without an error. Treat warnings or errors as an operational issue to investigate, not as proof that every object was captured.
  7. Record what the file contains. Keep the database scope, server version, command options, and creation time with the backup’s operational records. This makes it possible to select the correct restore procedure later.
  8. Test a restore. Load the file into an isolated target and check that the expected objects and representative application queries work. A restore test is the evidence that the logical export can actually be recovered.

How each important option changes the backup

Option Effect Use it when Important limitation
--single-transaction Begins a REPEATABLE READ transaction and reads a consistent state for transactional tables without blocking normal application access. The database is primarily InnoDB and must be dumped while online. It does not provide the same consistency for MyISAM or MEMORY tables, and concurrent DDL can invalidate or interrupt the consistent read.
--quick Retrieves rows a table at a time rather than buffering a whole table. Large tables or any dump paired with --single-transaction. It changes how rows are read; it does not add transactional consistency by itself.
--databases or -B Accepts multiple database names and writes CREATE DATABASE and USE statements. You want one file covering several named databases and want the dump to select them during reload. Reloading those statements requires the privileges they contain.
--routines Includes stored procedures and functions. The application depends on server-side routines. Do not assume routines are present unless this option is selected for the dump mode you use.
--events Includes Event Scheduler events. Scheduled database events are part of the application. For MySQL 8.4 with --all-databases, include this explicitly.
--triggers Requests trigger definitions. You want the intent of the command to be explicit. Triggers are included by default; --skip-triggers disables them.

Restore a mysqldump file

Restore into an existing database

mysql -u USER -p db_name < backup.sql

This sends the SQL file to the MySQL client, which executes it against the selected db_name. The target database must exist, and the account must be allowed to execute every statement contained in the dump. That can include object-creation, data-modification, view, trigger, routine, and event statements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restore a file made with --databases

mysql -u USER -p < backup.sql

When the dump contains the embedded CREATE DATABASE and USE statements produced by --databases, those statements can create and select the target databases during reload. The restoring account still needs the privileges required by the statements; embedding a command in the file does not bypass authorization.

Validate the restored result

  • Confirm that every expected database and table exists.
  • Check that views, triggers, routines, and events were restored when they were included in the backup scope.
  • Run representative read queries and, where safe, application-level checks.
  • Compare important row counts or other known data checks with the source.
  • Record any objects intentionally excluded so that an operator does not mistake a scoped dump for a complete server recovery.

Keep an online dump consistent

--single-transaction avoids blocking applications for transactional InnoDB tables, but it is not a license to change the schema freely during the export. While the dump is running, avoid ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, and TRUNCATE TABLE on dumped tables. Such statements can make the consistent read incorrect or cause it to fail.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Coordinate schema changes with the backup window, or otherwise ensure that DDL cannot affect the tables being read. For mixed-engine databases, separately assess nontransactional tables because the InnoDB snapshot guarantee does not extend to them.

Privileges to plan before scheduling

Privilege failures often appear only when mysqldump reaches a particular object. Plan the account against the objects and options actually used:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • SELECT: reading table data.
  • SHOW VIEW: reading view definitions.
  • TRIGGER: including trigger definitions.
  • LOCK TABLES: generally required when --single-transaction is not used.
  • PROCESS, RELOAD, or FLUSH_TABLES: potentially required by tablespace and GTID-related settings.

Grant only the access needed for the selected scope, and make sure the same or a deliberately different account has enough authority to execute the statements during restore.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

“Access denied” during the dump

Verify the username, password, host authorization, and database name first. Then map the failing object to the needed privilege: views need SHOW VIEW, triggers need TRIGGER, and a non-transactional dump may need LOCK TABLES. Tablespace or GTID-related errors can require the additional administrative privileges listed above.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

The dump is missing procedures or events

Check the exact command used. Add --routines for stored procedures and functions and --events for Event Scheduler events. If the command used --all-databases on MySQL 8.4, these options must be explicit.

Triggers are absent after restore

Triggers are included by default, so inspect the command for --skip-triggers and confirm that the restoring account can create them. If triggers were intentionally omitted, treat the result as a partial application backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The online dump fails or appears inconsistent

Look for concurrent DDL on dumped tables, especially the schema-changing statements that can invalidate a consistent read. Also check whether important tables use MyISAM or MEMORY, because --single-transaction does not give those tables the same snapshot guarantee as InnoDB.

The file restores slowly

A logical dump must replay SQL statements, so large exports can take a long time to reload. If recovery objectives require a restore substantially faster than a logical SQL reload can provide, evaluate a physical backup strategy instead. The MySQL documentation points to alternatives such as MySQL Enterprise Backup when logical-dump restore times become unacceptably long.

When mysqldump is the right backup method

Requirement How mysqldump fits Decision guidance
Portable logical copy of selected databases Strong fit; the output is SQL and can be loaded with the MySQL client. Use a named database or --databases scope and include required object types.
Online backup of mostly InnoDB tables Good fit with --single-transaction --quick. Control concurrent DDL and assess any MyISAM or MEMORY tables separately.
Very large database with strict, short restore-time target Potentially poor fit because recovery replays a logical SQL file. Compare the required restore time with a physical backup approach.
Point-in-time recovery Not provided by a standalone logical dump. Use a recovery design that supplies the required transaction-log or binary-log capabilities in addition to periodic backups.

The practical boundary is restore time. mysqldump is valuable when a portable, object-aware SQL export meets the recovery requirement. Once restoring the file takes hours or exceeds the service’s recovery target, a physical method deserves evaluation rather than further tuning of the same logical workflow.

A production-ready command checklist

  • Use --single-transaction --quick for a mostly InnoDB database that must remain available.
  • Add --routines and --events when the application uses stored code or scheduled events.
  • Leave triggers enabled unless their exclusion is intentional and documented.
  • Use --databases when a multi-database file should contain database-creation and selection statements.
  • Confirm privileges before the scheduled run, including extra requirements caused by tablespace or GTID settings.
  • Prevent conflicting DDL while a single-transaction dump is reading its tables.
  • Protect the SQL file and keep enough destination storage for the complete export.
  • Perform and document a restore test; do not equate a completed dump process with recoverability.
  • Move to a physical backup strategy when logical restore time no longer meets the deployment’s recovery objective.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.