Skip to main content

Importing a big size database dump

Only phpMyAdmin can import a database with a size smaller than 50MB. In case you have DotRoll Plus, DotRoll Ultra or DotRoll Pro hosting, you have the option of importing a larger database.

  • UPLOAD SQL DUMP

    Use an FTP client to copy the SQL dump you want to import to your storage. The file may be copied directly to the start directory of your storage (/home/username).

  • MYSQL DATABASE, USER, PASSWORD, AND PRIVILEGES

    On the cPanel interface, in the MySQL databases menu, create a MySQL user and set a password. Also assign the generated user to the database you want to import.

  • GENERATE SSH KEY, OR SET IT UP

  • CONNECT VIA SSH

  • PuTTY login

    PuTTY login

    In the Host Name (or IP address) field, enter the name of your main domain.
    Port is the default port 22.
    Next, click the “+” sign next to SSH.

    PuTTY login

    PuTTY login

    • In the Private key file for authentication box, enter the key for the cPanel interface or the private key that you created earlier.
      You can then save the configuration, but you can also connect to your storage immediately.
    • USING THE DATABASE IMPORT WITH SCREEN

      If you do not want to end the database import, enter the following command after the login:

      screen -S mysqlimport

      To import a database, you must issue the following command:

      mysql -udatabase_username -pdatabase_user_password -h localhost database_name <sql_dump_file.sql

      You can also use the Enter key to confirm your import.

      The switches mean:

      • -u MySQL database user name. Use the switch to enter the user name and do not need to be a space.
      • -p MySQL database user password.
      • -h MySQL server address

      The process may take longer depending on the server’s capacity and the size of the database. If you do not want to wait for the process, press the CTRL key and the a letter followed by the d key.

      "Ctrl-a" "d"

      With this command, the previously launched screen will be disconnected, however the operations released there will continue in the background. You can then close the current session by pressing the logout command or the “CTRL + D” keys.

    • CAPTURE SCREEN SESSION

      You can check the import process by re-logging on to the server using an SSH client and then issue the following command:

      screen -r

      If you run multiple screens in your background, you can use the following command to display the list of currently running screens.

      screen -ls

      The system will pop up a list of previously disconnected screens. You can rejoin the disconnected session with the following command:

      screen -r 864870.mysqlimport
    • CLOSE THE SCREEN SESSION, DELETE THE UPLOADED SQL FILE

      If you run only one screen, you can exit the exit command or use the following command:

      "Ctrl-a" "d" "d"

      Unfortunately, the command-line database import does not show a separate process flag of the import process. As soon as the imoprting is completed, the default command line will be returned. If there is an error in the file you want to import, the server stops the import process and writes the error. In such a case, the import will only occur to the fault.

      You may want to remove the SQL dump file you have stored for storage from the storage after the import is completed. Use this command to:

      rm sql_dump_file.sql