Re: [PHP] It's Friday (a MySQL Question)
[email protected] (tedd)
| Newsgroups | php.general |
|---|---|
| Message-ID | <p06240803c88b7b871b07@[192.168.1.104]> |
At 6:11 PM -0400 8/13/10, Daniel P. Brown wrote: >On Fri, Aug 13, 2010 at 17:48, tedd <[email protected]> wrote: >> >> 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. > > No, the 'access denied' message means that either the username or >password is incorrect, or that the given user doesn't have permission >to access the given database on the given host. Daniel : I don't think so and here's my reasoning. You see in the same script, I tested the connection to the database with a query *before* the OUTFILE statement and it worked! If the username and/or password had been wrong, then it would have also failed. Here's the demo: http://php1.net/c/db-dump/db-2-dir.php Please note that the string 'BKohl41' noted is the result of a query to the same database *before* the OUTFILE query. As far as I can tell, the MySQL statement does not have permission to create a file and that's the problem as I see it. I shall test Daevid's "GRANT SELECT, FILE ON mydb.table_reference TO 'me'@'localhost';" statement tomorrow -- it looks promising. As for the: "You know you can pass that on the command line right and avoid this pipe business?" No, I don't know how to do that. Cheers, tedd -- ------- http://sperling.com/