Import mysql file using command line on Linux needs several steps.
Step 1: Upload mysql file to server
You can use either ftp or scp to upload mysql file.
Step 2: Login to server
Login to server using ssh application. Example your website domain is pratama.us and username is demby. Type this command to login to your server.
ssh demby@pratama.us
You can change demby to your username and pratama.us to your domain or ip address.
Step 3: Import Mysql File
To import your mysql file to database you can use command below:
mysql -u USERNAME -p -h HOSTNAME DATABASENAME < FILENAME
Example if your mysql USERNAME is demby, HOSTNAME is localhost, DATABASENAME is dembydb and FILENAME is dembydb.sql, type this command to import.
mysql -u demby -p -h localhost dembydb < dembydb.sql
If you using ip address or domain as your hostname then your command become:
mysql -u demby -p -h 118.1.1.1 dembydb < dembydb.sql
or
mysql -u demby -p -h demby.pratama.us dembydb < dembydb.sql
After that, you can check your database and browse the data. This article is to remind me how to import mysql file to database using command line.
--
From Email