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

To duplicate a MySQL database on the same Linux host, create a logical dump, create the destination database, and load the dump into it:

mysqldump db1 > dump.sql
mysqladmin create db2
mysql db2 < dump.sql

Use --single-transaction for a transaction-consistent snapshot of many InnoDB workloads, and leave out --databases when the destination has a different name. For another server, either include database-creation statements in the dump or create the target database yourself before loading.

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

What a MySQL duplication actually copies

A logical dump recreates SQL definitions and table rows by writing statements to a text file and replaying them on the destination. It can reproduce tables, indexes, and data, and may also include views, triggers, stored procedures, functions, and events when those objects are present in the dump and the account has permission to read them.

A database copy is not automatically a copy of the entire MySQL server. Accounts, passwords, roles, and grants are server-level concerns stored in the mysql system database. Decide separately whether those definitions belong on the target; copying application tables without migrating users and privileges can leave an otherwise successful restore unusable, while copying all account data can unintentionally grant access in a development environment.

#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.

Before you start

Confirm the source and destination

  • Identify the source database name exactly, including case where the server’s operating system and MySQL settings make database-name case significant.
  • Choose whether the destination keeps the same name or uses a new name such as db2.
  • Confirm that the destination server has enough free disk space for both the SQL dump and the restored tables. A logical dump can temporarily require space for the dump file, the imported data, indexes, and InnoDB temporary work.
  • Use a MySQL account that can read every object you intend to export and create or load objects in the destination.
  • Protect the dump file. It contains the database’s data in readable SQL and can include sensitive values.

Check workload and maintenance timing

For a production system, schedule the operation with the application owner. A dump taken while writes continue can be consistent for transactional tables when the appropriate snapshot option is used, but schema changes are a separate risk. The mysqlpump documentation warns that ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, or TRUNCATE TABLE during a single-transaction dump can make the read inconsistent or cause the dump to fail. Freeze migrations and other DDL for the dump window, or use a backup procedure designed for your workload.

Duplicate a database on the same Linux host

Use the documented three-command procedure

  1. Dump the source database to a file:

    mysqldump db1 > dump.sql
  2. Create the destination database:

    mysqladmin create db2
  3. Load the dump into the destination:

    mysql db2 < dump.sql

The first command writes SQL for db1. The second creates an empty database named db2. The third connects to db2 and executes the statements from the file, creating the tables and inserting the rows.

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

Make credentials and connection details explicit

On a host with several MySQL instances, sockets, ports, or accounts, specify the connection parameters on each command. The password prompt is intentionally interactive when -p is used without a value:

mysqldump -u USER -p --single-transaction db1 > dump.sql
mysqladmin -u USER -p create db2
mysql -u USER -p db2 < dump.sql

Replace USER with the account that has the required privileges. If the source and destination use different sockets or TCP ports, add the appropriate host, port, or socket options consistently to the commands. Avoid putting a password directly on a shell command line, because it can be exposed through shell history or process listings.

Do not use --databases when renaming the destination

When the destination name differs, run mysqldump db1, not mysqldump --databases db1. The --databases option writes a USE db1 statement into the dump. If you then run mysql db2 < dump.sql, that statement switches the session back to db1, so objects can be loaded into the source-named database instead of db2. The destination-name procedure is therefore:

mysqldump db1 > dump.sql
mysqladmin create db2
mysql db2 < dump.sql

If you want the dump itself to carry database-creation and selection statements, keep the source name and use the cross-server pattern described below.

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.
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

Keeping the dump consistent while the server is busy

What --single-transaction does

For many InnoDB workloads, this option starts a transaction-consistent logical snapshot without locking every table for the entire dump:

mysqldump -u USER -p --single-transaction db1 > dump.sql

It is useful when applications must continue ordinary reads and writes while the export runs. It is not a universal consistency guarantee: nontransactional tables, concurrent schema changes, long-running writes, and workload-specific locking behavior still require review.

DDL is the important exception

Do not run migrations or ad hoc table-structure changes during a single-transaction dump unless you have verified their effect for your MySQL version and storage engines. Operations such as ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, and TRUNCATE TABLE can invalidate the read view or make the dump fail. A practical production plan has a defined DDL freeze, a maintenance window, or a backup mechanism that handles online schema changes.

When the default procedure is not enough

If the database contains non-InnoDB tables, rapidly changing schemas, or requirements for a crash-consistent server image, stop and choose a method that matches those constraints. A logical dump is portable and easy to inspect, but it is not the same as a physical backup of the server’s data files.

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

Copy a database to another Linux server

There are two documented patterns. Choose based on whether the dump should create the database and whether the target name must differ.

Pattern A: include database-creation statements

Use this when the target should receive the source database name and you want the dump to create it:

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.
  1. On the source server, create the dump:

    mysqldump --databases db1 > dump.sql
  2. Transfer dump.sql to the target server using your approved secure file-transfer method. Keep permissions restricted while the file is in transit and at rest.

  3. On the target server, load the file without naming a database:

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

The dump contains statements that create and select db1. The target account therefore needs permission to create the database and all objects represented in the file.

Pattern B: choose a different target name

Use this when the target should be called db2 or another name:

  1. On the source server, omit --databases:

    mysqldump db1 > dump.sql
  2. Transfer the file to the target server.

  3. Create the destination database on the target:

    mysqladmin create db2
  4. Load the dump into that database:

    mysql db2 < dump.sql

Add -u USER -p and, where necessary, host, port, or socket options to each command. For a busy InnoDB source, the export command can include --single-transaction, subject to the DDL and workload constraints above.

Decide which objects belong in the copy

Do not assume that “duplicate the database” has one universal scope. Write the intended scope into the change plan and verify each category after loading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
Object or setting What a logical database dump can reproduce Decision you must make
Tables, indexes, and rows Table definitions and row data are the normal contents of a dump. Usually required; check whether staging data must be anonymized before use.
Views View definitions can be included when exported. Confirm that referenced tables and definer accounts exist on the target.
Triggers Trigger definitions can be exported with the relevant objects. Check that triggers are not unintentionally firing during data load or application tests.
Stored procedures and functions Routine definitions can be included. Confirm required privileges, delimiters, SQL modes, and definer identities.
Events Event definitions can be included. Decide whether scheduled jobs should be enabled on a clone; a test copy may need them disabled.
Users, roles, and grants These are server-privilege data, not merely application-table contents. Migrate deliberately. The grant tables reside in the mysql database, and copying a user definition can expose production access on the target.
Server configuration and data files A logical dump does not reproduce the server’s physical files or configuration. Handle configuration, TLS, plugins, and storage separately.

Object-selection controls are available in MySQL’s logical-backup tooling, but the exact option set depends on the utility and MySQL version. For a straightforward full-database copy, start with mysqldump; for a selective export, enumerate the required object classes and test the resulting file before replacing any target data.

Verify the duplicate before an application uses it

A successful exit status only shows that the client processed the input. Verification must compare the source and destination in the way your application depends on.

  1. Confirm the database exists. Run SHOW DATABASES; on the target and verify the intended name appears.
  2. Compare table inventories. Run SHOW TABLES; in both databases. Investigate missing or extra tables before continuing.
  3. Compare representative row counts. For critical tables, run SELECT COUNT(*) FROM table_name; on both sides. For very large or actively changing tables, record the comparison point and interpret differences in light of dump timing.
  4. Check views and routines. Inspect SHOW FULL TABLES for views and query the routine metadata. Confirm that definitions reference the intended database and that definer accounts are valid.
  5. Check triggers and events. Inspect trigger definitions and scheduled events. A clone used for testing should not accidentally send mail, charge customers, or run production cleanup jobs.
  6. Check character sets and collations. Compare database defaults and critical table or column settings. Differences can change sorting, uniqueness, and comparison behavior even when row counts match.
  7. Test the application connection. Point a controlled client or staging instance at the target, authenticate with the intended account, run representative reads and writes, and review the server error log.
  8. Validate permissions. Test the least-privilege account the application will use. Do not infer access from an administrator account used only for the restore.

These checks are operational work to perform in your environment; they are not replaced by the dump command’s completion message.

Logical dump, mysqlpump, MySQL Shell, or physical backup?

The right method depends on scope, naming, object coverage, consistency requirements, and size. A logical SQL file is usually the most portable choice for a one-database clone or a copy that must be renamed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Best fit Strengths Important limits
mysqldump One database, same-host clone, or portable cross-server transfer. Simple commands, readable SQL, easy to load into a differently named database. Restore time grows with object and row count; consistency still depends on storage engines and workload control.
mysqlpump Older logical-backup workflows that need parallelization or object selection. Can parallelize work and include or exclude selected databases and objects. Oracle marks it deprecated as of MySQL 8.0.34 and directs users toward mysqldump and MySQL Shell dump utilities for current workflows.
MySQL Shell dump and load utilities Larger or parallel logical transfers where the environment supports MySQL Shell. Designed for modern dump/load workflows and parallel operations. Requires evaluating compatibility, operational procedures, and the target’s MySQL version rather than blindly substituting it for a three-command clone.
Physical backup Very large backup and restore workloads or server-level recovery. Preserves data files in their original format and can restore faster at large scale. Less portable for renaming one database; requires planning for server version, storage layout, permissions, and recovery procedures.

Oracle’s mysqldump reference describes cloning databases for development and DBA work and producing slight variations of an existing database for testing. It also identifies physical backup as more appropriate for large-scale backup and restore because the original data-file format can be restored more quickly.

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

Troubleshoot common failures

The data loaded into the wrong database

Inspect the dump for a USE statement. If it selects db1, the file was created with --databases and will override mysql db2 < dump.sql. Recreate the dump without that option, create db2, and load it again.

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.

Access denied appears during dump or restore

Check which account and server endpoint each command uses. The export account needs access to the source objects; the restore account needs permission to create or write the destination objects. If views, routines, triggers, events, or definers are involved, include the privileges those objects require rather than granting unrestricted access as a first resort.

The target database already contains tables

Do not load over an important database without a rollback plan. Stop, confirm the intended target name, and decide whether to remove and recreate the empty database, restore into a clean name, or deliberately merge selected objects. A logical dump is not a conflict-resolution tool.

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

The dump fails or contains inconsistent results

Review concurrent DDL first, especially the operations listed in the single-transaction warning. Check for nontransactional tables and long-running writes, then reschedule with a controlled maintenance window or choose a backup method appropriate to the consistency requirement.

Rows exist but the application behaves differently

Compare character sets, collations, SQL modes, time-zone settings, routines, triggers, events, and permissions. Also check external dependencies such as files, plugins, certificates, and application configuration; those are outside a database-only logical dump.

A repeatable runbook

  1. Record source host, MySQL version, database name, destination host, destination name, and the object categories required.
  2. Confirm disk capacity, account privileges, dump-file protection, and a maintenance or DDL-free window.
  3. Choose same-host or cross-server procedure, and decide whether names stay the same.
  4. For InnoDB workloads, add --single-transaction only after reviewing concurrent writes and preventing conflicting DDL.
  5. Create the dump and check that the command completed before transferring or loading it.
  6. Create the destination database when the selected pattern requires it; do not use --databases for a renamed destination.
  7. Load the file, capture errors, and retain the dump until verification and rollback decisions are complete.
  8. Run inventory, row-count, object-definition, collation, permission, and application-connectivity checks.
  9. Document whether users, grants, events, and other server-level settings were intentionally migrated or intentionally excluded.

This approach gives you a portable clone for development or testing while making the naming, consistency, security, and operational boundaries explicit.

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.