PASSWORD RESET

Your destination for complete Tech news

how to import an SQL file using command line in MySQL?

533 0
< 1 min read

To import an SQL file using the command line in MySQL, follow these steps:

  1. Open a terminal window and log in to MySQL as the root user:
mysql -u root -p
  1. Enter the password for the root user when prompted.
  2. Use the following command to create a new database:
CREATE DATABASE database_name;
  1. Use the following command to select the database:
USE database_name;
  1. Use the following command to import the SQL file:
SOURCE path/to/file.sql;

Replace database_name with the name of the database you want to create and path/to/file.sql with the path to the SQL file you want to import.

If the import was successful, you should see a message indicating that the import was completed.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.