This guide provides a simple way to restore a .sql file into your MySQL database using the command line.


Steps to Restore Your Database

  1. Open Terminal or SSH
    Access your server terminal directly or connect via SSH if you're working remotely.

  2. Navigate to the SQL File Location
    Use the cd command to go to the directory where your SQL backup file is stored:

     
    cd /path/to/your/sqlfile
  3. Run the MySQL Import Command
    Use the following command to begin the database restore process:

     
    mysql -u your_username -p database_name < database_filename.sql

    Replace your_username, database_name, and database_filename.sql with your actual MySQL credentials and file name.

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

Var dette svaret til hjelp? 0 brukere syntes dette svaret var til hjelp (0 Stemmer)