Link to home
Start Free TrialLog in
Avatar of infodigger
infodigger

asked on

Load .sql file into mysql through php

Hello,

I have a .sql file which contains a few queries and I need to load it into mysql. I tried two things, none of them worked:

1. Use file_get_contents and load the contents of the file into a php string and then use mysql_query to load them to the database. This didn't work at all.

2. Use load data command from mysql. This didn't work because I am on a shared hosting environment and I can't grand file access to the mysql user.

Is there any other alternative?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of NurAzije
NurAzije
Flag of Bosnia and Herzegovina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of infodigger
infodigger

ASKER

Thank you very much! It worked perfectly!