RE: How to importing database via Command Line (SSH)?
Using a command you can import a MySQL database into an existing database.
Please follow the below steps:
- Upload the SQL file to the server via the file manager or an FTP client like FileZilla.
- 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.
- Log into the server through SSH
- Navigate to the directory where your .sql file is.
- 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.)
- You will be prompted for your database user password, and then enter user password and your database will be imported.