Discussion:
Funky permission issue...
Don Wieland
2014-08-20 19:14:53 UTC
Permalink
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
Ashley Sheridan
2014-08-20 19:22:24 UTC
Permalink
Post by Don Wieland
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
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
Aziz Saleh
2014-08-20 19:39:14 UTC
Permalink
Post by Ashley Sheridan
Post by Don Wieland
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
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;
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).
Aziz Saleh
2014-08-20 19:42:45 UTC
Permalink
Post by Aziz Saleh
Post by Ashley Sheridan
Post by Don Wieland
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
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.*
identified by 'YOUR_PASSWORD';> flush privileges;
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).
Forgot to mention, borrowed the answer from this link:

http://stackoverflow.com/a/6091447
Don Wieland
2014-08-20 20:16:23 UTC
Permalink
Post by Aziz Saleh
http://stackoverflow.com/a/6091447
Okay I ran this separately:

grant all privileges
on dwdc_pps.*
to 'dwdc_pps'@'localhost'
identified by 'my_password';
flush privileges;

ERROR: Access denied for user 'dwdc_pps'@'%' to database 'dwdc_pps'

ERROR: [ERROR in query 1] Access denied for user 'dwdc_pps'@'%' to database 'dwdc_pps'
[ERROR in query 2] Access denied; you need (at least one of) the RELOAD privilege(s) for this operation

Then I ran this separately:

GRANT FILE ON *.* TO 'dwdc_pps'@'localhost';

ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TO 'dwdc_pps'@'localhost'' at line 1

SighÂ… Are you are I am going down the right path - heehee ;oP

Don Wieland
D W D a t a C o n c e p t s

Don Wieland
2014-08-20 20:04:14 UTC
Permalink
Post by Aziz Saleh
Post by Ashley Sheridan
grant all privileges
on dwdc_pps.*
identified by 'YOUR_PASSWORD';> flush privileges;
I thought I would just head to my Coda and perform the raw query to make sure it works. This is how I and entering the query:

grant all privileges on dwdc_pps.* to 'dwdc_pps'@'localhost' identified by 'my_password'>;
flush privileges;
GRANT FILE ON *.* TO 'dwdc_pps'@'localhost';

SELECT * INTO OUTFILE "/Macintosh HD/Users/donwieland/Desktop/data_test.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY " " FROM snomed_db;

I generates a slew of errors - probably something stupid in my syntax. Little help please...

ERROR: ERROR in query 1] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grant all privileges on dwdc_pps.* to 'dwdc_pps'@'localhost' identified ' at line 1
[ERROR in query 2] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'flush privileges' at line 1
[ERROR in query 3] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GRANT FILE ON *.* TO 'dwdc_pps'@'localhost'' at line 1
[ERROR in query 4] Access denied for user 'dwdc_pps'@'%' (using password: YES)



Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
***@dwdataconcepts.com
http://www.dwdataconcepts.com
Direct Line - (949) 336-4828
SKYPE - skypename = dwdata

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.php

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html
Loading...