how to import the database to mysql under linux?

advertisements

The sql file named:bag.sql in /var/www/html/web(/var/www/html/web/bag.sql)

the current directory is [localhost web]i used mysql -uusername -p databasename > bag.sql

then let me input the password. i wait for long time, it doesn't show ok. why? how to import the database to mysql under centos.


if you have already created database then use below steps to import data from .sql file

tell which database to use:

 use databasename;

Now give the source file path

 source /var/www/html/web/bag.sql;