Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk12 min

How to Import a MySQL Database Dump and Fix Common Import Errors

Use the right mysql command for your dump type, then troubleshoot access, database selection, syntax, encoding, PowerShell and packet-size errors with targeted fixes and validation steps.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a normal SQL dump, restore with mysql db_name < dump.sql. If the file was created with --all-databases or --databases, it normally contains its own database-selection statements, so mysql < dump.sql is appropriate. Most failed imports come from using the wrong target database, invalid credentials or grants, incompatible SQL, character-set problems, or packet limits. This guide shows how to identify the dump type, import it safely on Linux, macOS, Windows and PowerShell, and repair the common errors without guessing.

Choose the correct import command first

A MySQL SQL dump is a text file containing statements such as CREATE TABLE, INSERT, views, triggers or routines. The mysql command-line client reads those statements and sends them to the server. The command depends on whether the dump selects its own databases.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Dump situation Command What must be true
Created with --all-databases or --databases mysql < dump.sql The file normally contains CREATE DATABASE and USE statements.
Single-database dump without database-selection statements mysql db1 < dump.sql db1 already exists, or you create it first.
Import from an interactive client source dump.sql Connect first, select the target with USE db1;, then source the file.

Do not assume the filename tells you which case applies. Open the beginning of the file in a text editor or inspect it with a command such as head -n 80 dump.sql on a Unix-like system. Look for CREATE DATABASE and USE. A dump made without the --databases option generally contains table and data statements but does not create or select the database for you.

Pre-import checks that prevent most failures

Confirm that the backup is really an SQL dump

This procedure applies to a logical SQL dump. It does not directly restore a physical InnoDB tablespace, a raw data directory, a proprietary backup archive, or a delimited text export such as CSV. Those formats require different tools and procedures. A file that opens as readable SQL and contains statements beginning with words such as CREATE, INSERT or SET is likely a logical dump.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Inventory what the source contains

Before you overwrite anything, note the source database name, tables, views, triggers, routines, events, character sets and approximate row counts. If the backup creator supplied a schema or object list, keep it beside the dump. This gives you a concrete checklist for validation rather than relying only on the client’s exit status.

Check the target server and account

Connect with the account and endpoint you actually intend to use:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysql -u user -p -h db-host -P 3306

The -p option prompts for the password. Avoid putting a plaintext password directly in the command because it can remain in shell history or appear in process listings. Confirm the host, port, username and server edition or version. An account that can connect may still lack permission to create databases, tables, routines, triggers or other objects in the dump.

Protect existing data

Decide whether this is a replacement restore, a merge into an existing database, or a test import. A dump containing CREATE TABLE will fail when a table already exists unless the statements include suitable drop behavior. Preserve a current backup of the destination before making destructive changes, and prefer a new, empty database when you need an isolated test.

Check the file encoding

SQL containing accented characters, Asian scripts or emoji must be interpreted with the intended connection character set. A Unicode byte-order mark at the beginning of input is ignored by the mysql client, but it does not set the connection character set. When the dump is UTF-8, make that explicit:

mysql --default-character-set=utf8mb4 db1 < dump.sql

PowerShell deserves extra attention: its output redirection can produce UTF-16 text, which cannot be loaded as a MySQL connection character set. When creating a dump on Windows, use the dump program’s result-file option instead of PowerShell’s redirection:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysqldump --result-file=dump.sql -u user -p db1

Import a dump from a shell

Restore a dump that contains its own databases

For a file generated with --all-databases or --databases, connect to the server and let the file issue its own CREATE DATABASE and USE statements:

mysql -u user -p -h db-host -P 3306 < dump.sql

If the dump was designed to restore all databases, do not append a single database name: doing so can conflict with the file’s own database-selection statements.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Restore a single-database dump

Create the destination database if necessary, then pass that database to the client:

mysqladmin -u user -p -h db-host -P 3306 create db1
mysql -u user -p -h db-host -P 3306 db1 < dump.sql

If db1 already exists, skip the first command only after confirming that importing into it is safe. The target account needs the privileges required by the statements in the file, not merely permission to log in.

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

Set the character set while importing

Combine the database name with an explicit character set when the dump is UTF-8:

mysql --default-character-set=utf8mb4 -u user -p db1 < dump.sql

The character set option controls how the client sends text. It does not automatically convert a schema whose columns or tables were defined with an incompatible character set, so inspect the resulting definitions during validation.

Import from inside the interactive MySQL client

The interactive form is useful when you need to create or select a database, inspect an error, or run checks between steps.

  1. Connect: mysql -u user -p -h db-host -P 3306.
  2. Create the target if required: CREATE DATABASE IF NOT EXISTS db1;.
  3. Select it: USE db1;.
  4. Read the file: source dump.sql.

The semicolon is required for the SQL statements, but the client command source dump.sql is entered as shown. If the path contains spaces, use a correctly quoted path supported by your client and shell.

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

Windows and PowerShell commands

Why the usual redirection fails in PowerShell

PowerShell reserves the < operator, so a command copied from a Unix shell can fail before MySQL receives it. Run the redirection through the Windows command interpreter:

cmd.exe /c "mysql -u user -p db1 < dump.sql"

Use a full path to mysql.exe if it is not on PATH, and quote paths containing spaces. Alternatively, start the MySQL client normally and use USE db1; followed by source C:/path/to/dump.sql. The latter avoids shell redirection altogether.

Avoid producing a UTF-16 dump

Do not create a dump with PowerShell’s generic output redirection when the resulting file will be consumed as SQL input. Use:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
mysqldump.exe --result-file=C:backupsdump.sql -u user -p db1

Then import it with cmd.exe /c or the interactive source method. If a file already appears to contain UTF-16 characters or fails immediately with a character-set complaint, regenerate it or convert it deliberately to the encoding expected by the client rather than changing random bytes in the dump.

Diagnose import errors by code

Read the complete error, including the number in parentheses and the statement or line reported after it. The code narrows the category, but the surrounding SQL and connection details determine the repair.

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

ERROR 1044 or 1045: access denied

ERROR 1045 (28000) means authentication failed or the supplied password was not accepted. ERROR 1044 means the account was denied access to the named database. Check all of these together:

  • The username passed with -u.
  • The password entered at the prompt.
  • The host in -h; MySQL grants can differ between localhost, an IP address and another hostname.
  • The port in -P.
  • The account’s grants for the target database and object types.

Reconnect explicitly, for example:

mysql -u root -p -h db-host -P 3306

Do not solve an access error by embedding a password in the command. If you administer the server, inspect the account’s grants and provide only the privileges needed for the dump.

ERROR 1046: no database selected

The client is executing statements without a default database. Supply one on the command line:

mysql db1 < dump.sql

Or add USE db1; before sourcing the file in an interactive session. If the dump was expected to select a database itself, inspect its first statements; it may be a single-database dump that was created without database-selection options.

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

ERROR 1049: unknown database

The named database does not exist or its name is misspelled. Create it and retry:

mysqladmin create db1

In an interactive session, the equivalent is:

CREATE DATABASE db1;

Use the exact spelling and account permissions required by your environment. If the dump should create the database itself, remove the incorrect database argument and use the all-databases or databases-style command instead.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

ERROR 1050: table already exists

The dump attempted CREATE TABLE for a table already present in the target. Stop and choose one of three deliberate paths:

  • Restore into a newly created, empty database when the dump should replace the target.
  • Keep the existing table and use a dump or script designed to merge data, after checking for duplicate keys and schema differences.
  • Use a dump containing appropriate drop statements only when you have a verified backup and accept the destructive effect.

Do not delete tables simply to make the error disappear. Existing rows, permissions, views or application dependencies can be lost.

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

ERROR 1064 or 1149: SQL syntax error

These errors mean the server could not parse a statement. Capture the reported line and inspect the surrounding SQL, not just the final line printed by the client. Common compatibility causes include a source and target running different MySQL versions, a changed SQL mode, a reserved word used as an identifier, an unsupported character set, or syntax generated for another server family.

Compare the failing statement with the target server’s supported syntax and the dump’s origin. Repair the specific statement or regenerate the dump with options compatible with the destination. There is no safe blanket edit for every 1064 or 1149 error: changing quotes, semicolons or SQL modes without understanding the statement can silently alter the data or schema.

ERROR 1153: packet too large

A single SQL statement, row, or binary-log event can exceed max_allowed_packet. The client and server each have a limit, so increasing only one side may not solve the import. The MySQL Reference Manual gives example defaults of 16 MB for the mysql client and 64 MB for the server, and states a maximum packet size of 1 GB.

First try a client-side increase appropriate to the largest statement:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysql --max_allowed_packet=32M -u user -p db1 < dump.sql

If the server limit is also too small, configure the server, for example with a setting equivalent to:

mysqld --max_allowed_packet=128M

Use your deployment’s configuration file or service-management method rather than treating that example as a universal startup command. Restart or reload the server as required, confirm both effective values, and retry. Increase limits only as needed because larger packets consume more memory and can affect concurrent connections.

ERROR 2006 or 2013: server gone away or lost connection

During an import, these messages can be symptoms of the same packet-size problem: a large statement causes the server or client to close the connection. Check max_allowed_packet on both sides first. Also check whether the server restarted, the network path dropped, a proxy timed out an idle connection, or the import exceeded an operational timeout.

After correcting the cause, reconnect and rerun from a clean target when possible. If the first attempt committed only part of the dump, determine which objects and rows exist before rerunning; blindly replaying a partial import can produce table-exists or duplicate-key errors.

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.

Encoding and BOM failures

A byte-order mark at the start of Unicode input is ignored by the client, but it does not select the connection character set. Use --default-character-set=utf8mb4 when that is the encoding used by the dump, and ensure the target schema’s table and column definitions can represent the data. A PowerShell-created UTF-16 file is a separate problem; regenerate it with --result-file or convert it correctly before importing.

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

Handle version, SQL mode and schema differences

A dump is executable SQL, not a universal interchange format. The source and target versions can differ in supported data types, authentication behavior, reserved words, default expressions, character sets and SQL modes. Before editing a failing file, identify the exact statement and compare the source and target environments.

  • Check whether an identifier became a reserved word on the target; quote or rename it only after confirming every dependent object.
  • Check the dump’s SET statements and the target SQL mode when strictness or date validation changes behavior.
  • Check routines, triggers, events and views separately; they may require privileges or definitions not needed for ordinary tables.
  • Check collations and character sets when comparisons, indexes or non-ASCII data behave differently.

For a repeatable migration, regenerate the dump for the destination version when possible. Manual changes should be kept as a documented patch so a future restore is reproducible.

Validate the import instead of trusting a successful command

A client that returns to the prompt without an error does not prove that the application is complete. Run checks against the actual target:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. List databases: SHOW DATABASES;.
  2. Select the restored database: USE db1;.
  3. List tables: SHOW TABLES;.
  4. Inspect expected views, triggers and routines with the appropriate SHOW statements or metadata queries.
  5. Run targeted row-count checks on critical tables and compare them with the source inventory.
  6. Inspect representative records containing dates, non-ASCII text, binary values and nullable fields.
  7. Check table and column character sets and collations where encoding matters.
  8. Run an application smoke test covering login, reads, writes and any critical background job.

If the import was interrupted, record the last successful statement, compare the object inventory, and decide whether to clean the target and start again. A clean re-import is often safer than trying to infer exactly which portions of a large file were committed.

Choose an import approach by situation

Situation Recommended approach Primary risk to check
Full server backup with multiple databases mysql < dump.sql Account privileges and unintended replacement of existing databases.
One database, empty destination Create the database, then mysql db1 < dump.sql Correct database name and compatible source/target versions.
One database, existing production data Take a new backup, test in an isolated database, then plan a controlled replacement or merge Table collisions, duplicate rows and downtime.
PowerShell environment Use cmd.exe /c for redirection or the interactive source command PowerShell’s reserved < operator and UTF-16 output.
Very large rows or statements Set a suitable client and server max_allowed_packet, then retry Only one side was increased, or memory and timeout limits remain too low.
Version-mismatched servers Inspect the failing statement and regenerate or patch for the target version SQL mode, reserved words, data types and character-set differences.

A repeatable recovery checklist

  • Stop and preserve the original dump; work on a copy when editing is unavoidable.
  • Identify whether it contains CREATE DATABASE and USE.
  • Confirm the target host, port, account, password and required grants.
  • Confirm that the destination is empty or that replacement and merge behavior is intentional.
  • Use the right shell syntax, especially on PowerShell.
  • Set --default-character-set=utf8mb4 when that matches the dump’s encoding.
  • For 1153, 2006 or 2013, check both client and server packet limits and inspect server logs.
  • For 1064 or 1149, isolate the exact statement before changing SQL.
  • After a partial failure, inspect the target before rerunning.
  • Validate objects, counts, encodings and application behavior after completion.

What the error number tells you—and what it does not

Error numbers are starting points, not complete diagnoses. 1044 and 1045 direct you toward authentication, host matching and grants; 1046 and 1049 point to database selection or existence; 1050 points to a pre-existing table; 1064 and 1149 indicate parsing; 1153, 2006 and 2013 often involve oversized packets or a disconnected session. The exact command that fixes the problem still depends on the dump contents, server version, shell, account and state of the target database.

The safest workflow is therefore: inspect the dump, select or create the correct database, connect with a least-privilege account that can perform the required operations, import with the correct shell and character set, diagnose the first reported error, and validate the resulting schema and data. That sequence prevents a minor command mismatch from becoming a damaged or incomplete restore.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.