mysql_connect passes the parameters host, user, password
with php I wish to connect with the equivalent of the shell command
--local-infile=1 -u user -p password
My attempts at this have all resulted in syntax errors. How can I do this? |
Request for Question Clarification by
joseleon-ga
on
07 Mar 2003 00:25 PST
Hello:
As far as I know, you can use mysql from the shell this way:
mysql -h localhost -D test -u user -p passwrod
Do you want to connect to mysql using the shell and use that connection from PHP?
Regards
|
Clarification of Question by
hlf-ga
on
07 Mar 2003 05:07 PST
To all the commentators:
Thank you.
Yes, I wish to enter the complete logon with --local-infile=1 as part
of a PHP command. I do not own the server therefore I cannot
recompile to allow infile. This is, as Iunderstand it, a security
issue.
Howard
|
Request for Question Clarification by
sycophant-ga
on
07 Mar 2003 17:43 PST
HI,
As I don't believe that it is possible to actually do what you are
asking, would you accept an alternative?
I can provide some PHP code that could perform the same function as
the MySQL command LOAD DATA INFILE. It may not be quite as efficent as
the MySQL command, but assuming you simply want to load the contents
of a delimited text file into a MySQL table then it should be fine.
Let me know if this would be acceptable.
Regards,
sycophant-ga
|
Clarification of Question by
hlf-ga
on
08 Mar 2003 03:17 PST
Clarification for sycophant-ga,
Thank you. The problem is that mysql has been compiled on the system
as I use to block 'load data infile' and 'load data local infile'. The
only way around this is to invoke --local-infile=1 with the login.
I do have code for PHP/MYSQL for load data infile and load data local
infile.
Thanks for the offer.
All of my research shows that PHP/MYSQL does not permit the function I
seek. I will keep this question open for another day or so to see if
any miracles happen.
Thanks again for being so responsive.
HLF
|
Request for Question Clarification by
sycophant-ga
on
08 Mar 2003 17:54 PST
Hi,
I may not have been clear about my suggestion.
My suggestion was to not to use that command, as I realise that
functionality is not available to you, but to emulate it's function
using only standard MySQL and PHP commands, allowing you to achieve
the same end result, while not needing to use the blocked command.
This way you will be able to load the data from the file without
having to use LOAD DATA INFILE.
Would that be any help? Or do you really need to use the LOAD DATA
INFILE command to populate the table?
Regards,
sycophant-ga
|
Clarification of Question by
hlf-ga
on
09 Mar 2003 05:00 PST
You are correct. I do not need to use
|
Clarification of Question by
hlf-ga
on
09 Mar 2003 05:03 PST
You are correct. I do not need to use LOAD DATA LOCAL INFILE, but I do
need to populate an existing table structure with the contents of a
properly formatted file. If you know another way of doing this, I
would like to see it. I had thought about doing a loop with series of
INSERTS but was concerned about performance with large files.
HLF
|
Clarification of Question by
hlf-ga
on
09 Mar 2003 12:55 PST
Many thanks to all the commentors. I am going to close the question
having concluded that neither PERL nor PHP allows what I want to do so
I will work around it.
HLF
|