mysqlsh: How to import a dump file

Viewed 1999

Usually I have a local installation of a MariaDB and when I import an sql-dump I use the following command:

C:\Program\MariaDB\bin\mysql testdb < C:\Downloads\dump.sql -u mariadbadmin -p -h localhost

where testdb ist the database I want to be loaded with the content of dump.sql. Now, I have a remote instance of MariaDB and the administrator installed on my local computer (Windows 10) the client mysqlsh.

I did not succeed to import the dump file. For example I tried:

mysqlsh -h vm-remote -u mariadbadmin -p --mysql testdb <C:\Downloads\dump.sql

which gives me:

Conflicting options: provided host differs frm host in the URI

Can someone show me how is the correct syntax to import a dump file using mysqlsh?

2 Answers

I found the following solution

mysqlsh -h vm-remote -u mariadbadmin -p --sql
MySQL  vm-remote:3306  SQL > use testdb;
MySQL  vm-remote:3306  test0  SQL > \.  C:\Downloads\dump.sql

There is an output on the shell for the inserts but it stops after few inserts. So, if ther are millions of inserts not every will be shown.

enter into MariaDB as root user

mysqldump --databases testdb > dump.sql
Related