Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import the database to mysql under linux?

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.

like image 200
user1188320 Avatar asked Dec 02 '25 05:12

user1188320


2 Answers

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;

You need mysql -uusername -p databasename < bag.sql.

<     Means "get the program's input from this file"
>     Means "write the program's output to this file"
like image 34
Joni Avatar answered Dec 03 '25 21:12

Joni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!