I have a free account on 000webhost. How can I import multiple SQL script files in PhpMyAdmin?
I have the database definition, records to insert and stored procedures to create in those scripts for my MariaDB database.
So, if I have multiple scripts with names like:
script-1.sql
script-2.sql
script-3.sql
…
script-n.sql
I have to put them all into a zip file that it may be named, for example, like:
scripts.sql.zip
That is precisely what I wanna avoid at all costs!
I have a total of 116 SQL scripts, the most of them are the SP’s that I have to use for my database, each one in a different script, and I have to use all of them.
Is there really no other way to make this massive upload of files in PhpMyAdmin?
I imagine you could do it in PHP. May we see a cut-down sample of one of the SQL files? Is it a set of SQL statements that are semi-colon separated?
This script looks like it would work. It uses the multi_query method in the MySQLi connector, which will save you the bother of writing PHP to parse your SQL into lines.
How long do they normally take to import? Try triggering your import script over the web to start with, but if this times out because the files are large, you might be able to do something with cron. Depends on whether you overflow the permitted storage size in MySQL for free accounts, I guess .
Yes, I checked that solution too but If I’ll do that, I have to copy the files content in an established order (I mean, database definition file -> insert demo values file -> stored procedures definition files).
In this sense, what I can do is create a Windows batch file to execute this command with all those parameters and generate this final SQL file more quickly.
Thanks you. I will try this solution before the PHP multi_query and I will tell you how it goes.