K
K
khodos_dmitry2022-02-07 10:56:26
linux
khodos_dmitry, 2022-02-07 10:56:26

Why can't I import a table through the console on an Ubuntu server?

Went into MySQL:

mysql -u user -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 833524
Server version: 10.1.43-MariaDB MariaDB Server

Selected base:
MariaDB [(none)]> use mydatabase
Database changed

And I import:
MariaDB [mydatabase]>  < /var/www/user/data/www/site.ru/backup/file.sql;

Mistake:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '< /var/www/user/data/www/site.ru/backup/file.sql' at line 1

This is also an error:
MariaDB [mydatabase]> mydatabase < /var/www/user/data/www/site.ru/backup/file.sql;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2022-02-07
@khodos_dmitry

If you are already running mysql, you can execute an SQL script file using the source command or \. command:
mysql> source file_name
mysql> \. file_name


https://dev.mysql.com/doc/refman/8.0/en/mysql-batc...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question