- Your cart is currently empty.
How to Import a MySQL Database via SSH
Do you want to import a MySQL database that contains a lot of data and is 100 MB or more in size? Importing via phpMyAdmin will most likely not be possible in this case, as the HTTP protocol has certain limitations. Also, servers have a default limit on the maximum file that can be uploaded.
In this case, you can import the SQL file very easily via the SSH protocol.
1. Upload the SQL file to the server
First, you need to upload the SQL file to your hosting package. If the file is not too large (up to a few 100 MB), this can be done via the File Manager application in the cPanel control panel. If the file exceeds this value, we recommend using the FTP protocol.
For instructions on how to transfer a file to the server using the FTP protocol, see How do I install a website on a hosting package?
You can upload the file to any directory you like, but otherwise we recommend the “root” directory of your hosting package (example: “/home/vasadome”).
2. IMPORTING THE SQL FILE
You must first connect to the hosting package via SSH. Once you have successfully connected, you will be automatically moved to the “root” directory of the hosting package (you can check this by using the “pwd” command).
In the first step, we uploaded the SQL file to the “root” directory, which can be verified with the “ls” command, which will list all folders and files in the current directory.
To import the file, we can use the command below, where instead of “USERNAME” we enter the user who has access to the MySQL database. Instead of “DATABASE”, enter the name of the MySQL database you want to import the data into. The file “vasadomena.sql” is the file that we uploaded to the “root” directory of the hosting package.
mysql -u USERNAME -p DATABASE < vasadomena.sql
When you enter and confirm the command, all you need to do is enter the password from the user you wrote in the above command (the user must be assigned to the MySQL database you entered).
The import time depends on the size of the database you want to import. After a successful import, you will not receive any notification, but you will just be returned to the option to enter a new command.
You can then check the success of the import in the phpMyAdmin application in the cPanel dashboard.
For further assistance, please call us on 059 335 000 or email us at info@neoserv.si.



COMMENT THE POST
Your comment has been successfully submitted
The comment will be visible on the page when our moderators approve it.