8

How to Import SQL Files into a MySQL database using Command Line

 2 years ago
source link: https://www.laravelcode.com/post/how-to-import-sql-files-into-a-mysql-database-using-command-line
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to Import SQL Files into a MySQL database using Command Line

  1107 views

  7 months ago

MySql

In this article, I will share with you how to import multiple SQL files in the database at the same time using a command line. many developers don't know how the import more than one file at the same time using the command line in ubuntu. so, here I will share one trick for this problem.

If you have multiple SQL files in one folder and you want to import that all at the same time so, no need to waste your time. please follow the simple steps.

Merge all file into one file

First, we need to merge that all SQL files into one single file using the below ubuntu command.

cat *.sql  > all_files.sql

then import that file in your selected database using the following command.

Login mySql

sudo mysql -u root -p

then hit the Enter and put your MySQL password.

Select Database

use your_database_name

Import selected SQL file

source path_your_sql_file

i hope you like this article.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK