Re: [PHP] It's Friday (a MySQL Question) [Solution]

[email protected] (tedd)
Newsgroups php.general
Message-ID <p06240801c89079186421@[192.168.1.104]>
At 5:48 PM -0400 8/13/10, tedd wrote:
>Normally if I want to dump a MySQL database, I read the database via 
>a PHP script (i.e., list tables and fetch rows) and save the results 
>as a text file -- after which I download the file -- it's not a big 
>deal.
>
>However while I was doing my daily read of the MySQL Manual, namely:
>
>http://dev.mysql.com/doc/refman/5.0/en/select.html
>
>I came across this statement:
>
>     SELECT * FROM table_reference INTO OUTFILE 'file_name'
>
>It looked to be bit simpler/shorter than my code, so I tried it. But 
>it reports:
>
>     Access denied for user 'me'@'localhost' (using password: YES).
>
>I suspect that the "access being denied" is because MySQL doesn't 
>have permission to create the output file. The MySQL manual reports: 
>1) that a file cannot be present; 2) AND MySQL must have file 
>privileges to create the file -- but I don't know how to set that up.
>
>So, has anyone got this to work? If so, how did you do it? If at all 
>possible, please provide code (MySQL/PHP) and not command-line 
>statements.

The problem here was that I am on a hosted account and do not have 
"Server Access" to use the "SELECT ... INTO OUTFILE" syntax.

I suspected such, but it took several exchanges on the mysql list to 
prove the issue.

In short, unless you have "Server Access" , then you cannot use the 
"SELECT ... INTO OUTFILE" syntax in php.

Cheers,

tedd

-- 
-------
http://sperling.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.