I have sql files "separated" like this:
> tree sql
sql
├── adresse_trigger_update_before.sql
├── attribut_trigger_update_before.sql
├── categorie_trigger_update_before.sql
├── duplicate_records.sql
├── horaire_trigger_update_before.sql
├── partenaire_trigger_update_before.sql
├── personne_trigger_update_before.sql
└── produit_trigger_update_before.sql
0 directories, 8 files
>
Here are all my tries:
>mysql mydatabase -e "source sql/file1.sql"
>
>mysql mydatabase -e "source sql/*"
>ERROR at line 1: Failed to open file 'sql/*', error: 2
>cat sql/* > mysql mydatabase
>cat : option invalid -- 'p'
>mysql mydatabase -e "source sql/*"
>bash: sql/* : ambiguous redirect
How to load many files at once in MySQL?
Nota: there's only one problem I'm facing: load all the files in the "sql
" folder at once. No other problem (I've removed user and password to be more precise about the actual problem).
Any idea how to do this?
Here's my solution:
You should use
"source code"/*
instead.For the password issue , try quote it , e.g
mysql -u XX -p "XX"