Certainly, this method is very helpful when you have a very heavy SQL file to be imported to any database, even if the SQL file is as large as 1GB the import is done more than 100 times faster than importing it through phpmyadmin.
Follow the below steps to import very large sql file through cmd :
first of all, we need to open the command prompt in administrator privilege.
furthermore, change your location to “C:\xampp\mysql\bin>mysql”. run command: “cd C:\xampp\mysql\bin>mysql”
after that you need to run this command: “mysql -u {DB_USER} -p {DB_NAME} < path/to/file/filename.sql” where you have to enter your database user_name and database name.
Finally merging both 2nd and 3rd point the whole syntax is :
C:\xampp\mysql\bin>mysql -u {DB_USER} -p {DB_NAME} < path/to/file/ab.sql
Example:
C:\xampp\mysql\bin>mysql -u itllive_admin -p itllive_db04 < C:\ITL\2021-01-26\itllive_db04.sql
How to Import Large Database into Live Hosted Server?
First create a folder (i.e: mysql_dump) inside public_html using cPanel. Upload the mysql backup into the folder.
Create a database and add a user to it.
Finally login to the server (preferably using Putty) through SSH. Then run the following command.
mysql -u itllive_admin -p itllive_clonedb < /home/itllive/public_html/mysql_dump/itllive_db04.sql
In another duplicate putty session you may keep the mysql log open with following command for monitoring error.
tailf /var/log/mysqld.log
