Import MySQL Dumpfile, SQL Datafile Into My Database

www‮.‬lautturi.com
Import MySQL Dumpfile, SQL Datafile Into My Database

To import a MySQL dump file or an SQL data file into your database, follow these steps:

  1. Make sure that you have a database and a user account with the necessary privileges to import the file. If you don't have a database set up, you can create one using the following command:
CREATE DATABASE database_name;
  1. Create a user account with the necessary privileges to import the file using the following command:
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
  1. Connect to the database using the mysql command-line client:
mysql -u username -p database_name
  1. Use the source command to import the dump file or data file into the database:
source path/to/file.sql

Note that the source command is used to execute a script file in the MySQL command-line client. The path/to/file.sql should be replaced with the actual path to the file on your system.

If the file is large, the import process may take a while to complete. Once the import is finished, you can use the SHOW TABLES; command to see the list of tables in the database.

Created Time:2017-10-29 22:08:48  Author:lautturi