Importing Mysql file

How to import SQL ( more than 50MB) through SSH

( i ) For already created Database:

Step1 : Login to your SSH with root user.

Step2 : Use command

mysql -u user_name -p -h localhost data_base_name < /home/user_name/public_html/sql file_name.sql

Step3 : Enter the password to start restoring the database.

 

( ii ) Creating and importing Database:

Step1 : Login to your SSH with root user.

Step2 : Enter into MySQL using “root” user identified by password.

#mysql -u root -p

Step3 :Create the database

mysql> CREATE DATABASE NEWDB;

Step4 :Create the user

mysql> CREATE USER 'newuser'@'localhsot' IDENTIFIED BY 'newpass';

Step4 : Grant ALL privileges onthe new database to the new User

mysql> GRANT ALL PRIVILEGES ON NEWDB.* TO 'newuser'@'localhost' IDENTIFIED BY 'newpass';

Step4 : Insert data from source.sql

mysql> SOURCE source.sql

You may also like...