MySQL import from commandline on Synology
MySQL (or MariaDB) import from commandline on Synology
Platform: Synology DSM 6.x
Import files through phpMyAdmin is slow and somewhat peculiar, especially when importing big files.
Importing an export into MySQL requires that you have setup: 1) a user with rights to import to 2) a database.
Good practise is to create a specific (admin-like) user for each DB.
It's fairly easy to do this using phpMyAdmin (Home/menu User Accounts/select Create New User/select the option to create a user with same name as the DB) .
Now, on to the Synology
Platform: Synology DSM 6.x
Import files through phpMyAdmin is slow and somewhat peculiar, especially when importing big files.
Importing an export into MySQL requires that you have setup: 1) a user with rights to import to 2) a database.
Good practise is to create a specific (admin-like) user for each DB.
It's fairly easy to do this using phpMyAdmin (Home/menu User Accounts/select Create New User/select the option to create a user with same name as the DB) .
Now, on to the Synology
- Login through SSH (so enable this if needed)
- The MySql binaries are not in the path, you'll need to use the full path to the binary
- /usr/local/mariadb10/bin/mysql
(this is a symlink to the binary in the package, for example /volumex/@appstore/MariaDB10/usr/local/mariadb10/bin/mysql) - Suppose you'll want to import.sql file in the shared folder MyFiles, on volume1, also use the full path to the SQL file to be imported.
- Now the command will be:
/usr/local/mariadb10/bin/mysql -p -u <the-username-for-the-DB> <DBname> < /volume1/MyFiles/import.sql
- Stack overflow : how do I import an sql file using the command line in MySQL
Reacties
Een reactie posten