How to importing database via Command Line (SSH)?

Want to importing database via SSH in Cpanel

Team Leader Asked on December 12, 2018 in TECHNOLOGY.
Add Comment
1 Answer(s)

Using a  command you can import a MySQL database into an existing database.

Please follow the below steps:

  1. Upload the SQL file to the server via the file manager or an FTP client like FileZilla.
  2. If the database does not exist, please create a database, a user, and give the user full privileges to the database. keep  the username and password save in a text file.
  3. Log into the server through SSH
  4. Navigate to the directory where your .sql file is.
  5. Type in this command:
    mysql -p -u user_name database_name <filename.sql                  (replace ‘user_name’, ‘database_name’, and ‘filename.sql’ with the actual name.)
  6. You will be prompted for your database user password, and then enter user password and  your database will be imported.
Team Leader Answered on December 13, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.