Re: Funky permission issue...
| From: | Aziz Saleh | Date: | Wed, 20 Aug 2014 19:39:14 +0000 |
| Subject: | Re: Funky permission issue... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323771@lists.php.net to get a copy of this message | ||
On Wed, Aug 20, 2014 at 3:22 PM, Ashley Sheridan <ash@ashleysheridan.co.uk>
wrote:
>
>
> On 20 August 2014 20:14:53 BST, Don Wieland <donw@dwdataconcepts.com>
> wrote:
> >Got another fun one:
> >
> >Trying to run this code/query from a php page:
> >
> >mysql_connect('localhost', 'dwdc_pps', 'hidden') or
> >die(mysql_error());
> >mysql_select_db('dwdc_pps') or die(mysql_error());
> >
> >$q = "SELECT * INTO OUTFILE \"/Macintosh
> >HD/Users/donwieland/Desktop/data_test.csv\"
> >FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
> >LINES TERMINATED BY \"\n\"
> >FROM snomed_db";
> >
> >echo $q;
> >
> >$result=mysql_query($q) OR die("Error:".mysql_error());
> >
> >Generating an error: Error:Access denied for user
> >'dwdc_pps'@'localhost' (using password: YES)
> >
> >Basically I am trying dump a tables contents LOCALLY on my MAC. This
> >PHP is in a sub-domain of where the mysql database was created.
> >
> >Any ideas on what my problem is and how to remedy it?
> >
> >Don Wieland
> >D W D a t a C o n c e p t s
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> First, try not to use the mysql_* functions, use mysqli_* or something
> like PDO instead, they're more secure.
>
> Your problem here though looks like you have either the username or
> password wrong for your MySQL account. Are you able to connect via a
> different program, like phpMyAdmin, or sqlYog with those credentials?
> Thanks,
> Ash
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> grant all privileges
on dwdc_pps.*
to 'dwdc_pps'@'localhost'
identified by 'YOUR_PASSWORD';> flush privileges;
> GRANT FILE ON *.* TO 'dwdc_pps'@'localhost';
Also you might want to use PDO or mysqli, because it is deprecated and does
not provides Prepared Statements if it is not a hard change. If your
codebase is already done and you are just modifying it then don't worry
about it (unless you have the resources to rewrite it, then you should).