Running multiple SQL files at once

5,005

Try this instead:

cat *.sql | mysql -u root -p db_name
Share:
5,005

Related videos on Youtube

Dormouse
Author by

Dormouse

Currently developing with Ruby (Rails) and Javascript (React/Redux). Variety of past & present experience includes mobile development (React Native, Android, Cordova), SQL, Java, PHP, C/C++, etc.

Updated on September 18, 2022

Comments

  • Dormouse
    Dormouse over 1 year

    I feel like I've run commands like the following in the past, but I'm getting an error trying it right now. Maybe I'm just having a brainfart, and my syntax is off.

    mysql -u root -p db_name < *.sql
    

    What I expect this to do is run all the SQL files in the folder ordered alphanumerically. However, I'm getting this error:

    -bash: *.sql: ambiguous redirect