jueves, 22 de abril de 2021

MySql: Execute SQL with command line

1) Single sql file

Using MySQL Command Line Client

if you need to execute it on a particular db, first:

use <db_name>

then:

source <full_path_of_file>

in windows you need to use '/' instead of '\'

2) Multiple sql files (in Windows)

open bash terminal navigate to the folder where the sql files are and then execute:

cat *.sql | mysql -u <user> -p <db_name>

No hay comentarios:

Publicar un comentario