importing backup by terminal MariaDB

0

Yesterday I was testing PostgreSQL for insertion and backup import and export, and PostgreSQL has an SQL import command like this:

psql# \i backup.sql

Is there anything related to this in MariaDB(MySQL) without being plain by the terminal itself?

MariaDB [teste]> ?
    
asked by anonymous 24.01.2018 / 23:44

1 answer

2

In MariaDb you can use source or simply \. to execute a .sql file, for example:

MariaDB> source file.sql

MariaDB> \. file2.sql

There are other ways to run a script as well:

user@pc: mysql -u USUARIO -p < file.sql

You can also use mysqlimport , for example:

user@pc: mysqlimport [OPTIONS] DATABASE file.sql file2.sql ...
    
09.03.2018 / 09:01