This guide provides a simple way to restore a .sql
file into your MySQL database using the command line.
Steps to Restore Your Database
-
Open Terminal or SSH
Access your server terminal directly or connect via SSH if you're working remotely. -
Navigate to the SQL File Location
Use thecd
command to go to the directory where your SQL backup file is stored: -
Run the MySQL Import Command
Use the following command to begin the database restore process:Replace
your_username
,database_name
, anddatabase_filename.sql
with your actual MySQL credentials and file name. -
Enter Your Password
When prompted, enter your MySQL user password to continue.
Once the process completes, the contents of database_filename.sql
will be successfully imported into the database_name
database.