I want to import files under the directory in bulk in mysql.

Asked 1 years ago, Updated 1 years ago, 392 views

I can't think of a way to import all the files under the db directory into mysql at once, so please let me know.
For my part, I was wondering if I could get the file name list with ls-1db and do well, but I couldn't think of a good way.

db
├-- 1.sql
├-- 2.sql
├-- 3.sql
└-- 4.sql

We are looking for ideas and opinions like, "Shouldn't we do this?"
As a questioner, I will respond as soon as possible, so please reply!

mysql shell

2022-12-18 19:00

1 Answers

If the SQLite database file is data.db, and you use xargs.

$finddb-maxdepth1-type f-name'*.sql'|xargs-I@sh-c'sqlite3data.db<@'


2022-12-19 00:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.