Page 1 of 1
Importing /Exporting mysql data
Posted: Thu Jul 31, 2003 3:07 pm
by JPlush76
I have a shared webhosting account and it appears I cannot use LOAD DATA INFILE or SELECT * INTO OUTFILE because of their security concerns.
Is there any other way to import/export mysql data if you can't use those two options??

Posted: Thu Jul 31, 2003 5:32 pm
by sitething
I'm guessing you don't mean importing/exporting .sql files?
In which case mysql -u <username> -p < myfilename.sql
or to export...
mysqldump --opt -p [database_name] > filename.sql
If not then I don't know anything off the top of my head that would work. It's a good question though, now I'm curious.
BTW, just what type of security concern is there with a LOAD DATA command? I can think of none.
Posted: Thu Jul 31, 2003 5:34 pm
by JPlush76
This is the email I got back from tech support
You said you were aving
problems with export and import to the database using these commands
'load data in file' 'into out file' I asked our Unix administrator
about this and here is
what he said.
"It's a security issue. The short answer is don't ever expect them to
work right. And even if he is sucessful in making them work now, they
may not work in the future. It has to do with the fact, that the load
commands cause the database server to load a file. It will only work
when the database is on the same machine as the file, and it's user has
access to the file. Both are rather unlikely in a shared environment.
You should try using Inserts and Selects commands."
Please let me know if there is anything else I can help you with.
I mean importing/exporting comma separated text files. for example you have a bulk upload of data sitting in an excel file.. convert that to comma sep and load it all up in one shot with load data infile.
Posted: Thu Jul 31, 2003 5:42 pm
by sitething
Glad it's not my host
Anyhow. I'm thinking you could work around this issue using PHP?
fgetcsv() looks interesting. Wouldn't be hard to work up a script to import.
http://www.php.net/manual/en/function.fgetcsv.php