how to import the sql file in an exist database connection..

Regards

Recommended Answers

I'm not quite sure what you mean... Do you want to fetch an SQL file and run the query that it contains? Just fetch the contents of the file end put the contents in the mysqli_query().

Jump to Post

All 2 Replies

I'm not quite sure what you mean... Do you want to fetch an SQL file and run the query that it contains? Just fetch the contents of the file end put the contents in the mysqli_query().

this is just simple query.Do you want to do using PHP or by mysql.
For mysql just run this command(before this add path of mysql till bin in your system variable path)

mysql -u <user> -p<password> -h <hostname> <database> < /path/to/updated_script/database.sql

or another way is

mysql> Create database test
mysql> use test
Then import the database into test databse by using one of this commend:-
source test.sql
or
./ test.sql
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.