RE: [PHP] Can't connect to MySQL via PHP
-Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: Saturday, January 12, 2013 7:55 PM To: admin Cc: a...@ashleysheridan.co.uk; Rick Dwyer; php-general@lists.php.net Subject: Re: [PHP] Can't connect to MySQL via PHP On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com wrote: As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. It's not this php list. It's the php developers. mysql* functions are set to be removed in a release coming soon. Time marches on. mysql* functions were written first, then the mysqli* functions were written. mysql* is old, out of date, and not begin supported. Should not have written it? Maybe? But maybe no libraries should have been written, nothing should move forward, better ways should not have been found. Maybe you want to do your computing using pebbles, too. So let me understand how this works. Someone ask for help, no matter what version they are using or function that is currently in place. We slam them. Call them an idiot. Not that they ask a question about a function in the CURRENT version. Yes the documentation does fully express the function is depreciated, but let's deal with the now. So let's NOT answer the question? (Hello, welcome to MICROSOFT) I am very glad 90% of other languages that have list don't have the same approach. They would gladly give you the answer, but then go on to express how they may suggest this (with example) because it is (safer, easier, ect...). Every time I see someone give a simple answer in an approach to help them learn, in comes the marching band of ignorance and they are toting the banner of epic fail. This is a list to help people understand php and grow the community and knowledge base of its inner workings. If you want to answer at question please at least use SOMETHING that is conducive to educating them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
On Sun, 2013-01-13 at 11:37 -0800, admin wrote: -Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: Saturday, January 12, 2013 7:55 PM To: admin Cc: a...@ashleysheridan.co.uk; Rick Dwyer; php-general@lists.php.net Subject: Re: [PHP] Can't connect to MySQL via PHP On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com wrote: As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. It's not this php list. It's the php developers. mysql* functions are set to be removed in a release coming soon. Time marches on. mysql* functions were written first, then the mysqli* functions were written. mysql* is old, out of date, and not begin supported. Should not have written it? Maybe? But maybe no libraries should have been written, nothing should move forward, better ways should not have been found. Maybe you want to do your computing using pebbles, too. So let me understand how this works. Someone ask for help, no matter what version they are using or function that is currently in place. We slam them. Call them an idiot. Not that they ask a question about a function in the CURRENT version. Yes the documentation does fully express the function is depreciated, but let's deal with the now. So let's NOT answer the question? (Hello, welcome to MICROSOFT) I am very glad 90% of other languages that have list don't have the same approach. They would gladly give you the answer, but then go on to express how they may suggest this (with example) because it is (safer, easier, ect...). Every time I see someone give a simple answer in an approach to help them learn, in comes the marching band of ignorance and they are toting the banner of epic fail. This is a list to help people understand php and grow the community and knowledge base of its inner workings. If you want to answer at question please at least use SOMETHING that is conducive to educating them. At no point was I slamming someone for using the old functions, in-fact I was trying to make a joke of that and point out that the msqli functions would be better, unless you really do believe that kittens will kill programmers... The thing is most of us expect the person asking the question here to have done at least a little bit of research into the problem, even if that only extends to I'll Google some of these keywords in the error. That should at least have produced the same advice about those old deprecated functions, but I wanted to reiterate it a bit just to be sure. It can't hurt to know something like that. The fact is, what you considered a simple answer was bad advice, and would have just taught more people that those old functions are fine, when in-fact they are not. I think it's very important to make people aware of security concerns, especially if they're a beginner with the language. Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Can't connect to MySQL via PHP
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Sunday, January 13, 2013 8:52 AM To: admin Cc: 'tamouse mailing lists'; 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sun, 2013-01-13 at 11:37 -0800, admin wrote: -Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: Saturday, January 12, 2013 7:55 PM To: admin Cc: a...@ashleysheridan.co.uk; Rick Dwyer; php-general@lists.php.net Subject: Re: [PHP] Can't connect to MySQL via PHP On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com wrote: As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. It's not this php list. It's the php developers. mysql* functions are set to be removed in a release coming soon. Time marches on. mysql* functions were written first, then the mysqli* functions were written. mysql* is old, out of date, and not begin supported. Should not have written it? Maybe? But maybe no libraries should have been written, nothing should move forward, better ways should not have been found. Maybe you want to do your computing using pebbles, too. So let me understand how this works. Someone ask for help, no matter what version they are using or function that is currently in place. We slam them. Call them an idiot. Not that they ask a question about a function in the CURRENT version. Yes the documentation does fully express the function is depreciated, but let's deal with the now. So let's NOT answer the question? (Hello, welcome to MICROSOFT) I am very glad 90% of other languages that have list don't have the same approach. They would gladly give you the answer, but then go on to express how they may suggest this (with example) because it is (safer, easier, ect...). Every time I see someone give a simple answer in an approach to help them learn, in comes the marching band of ignorance and they are toting the banner of epic fail. This is a list to help people understand php and grow the community and knowledge base of its inner workings. If you want to answer at question please at least use SOMETHING that is conducive to educating them. At no point was I slamming someone for using the old functions, in-fact I was trying to make a joke of that and point out that the msqli functions would be better, unless you really do believe that kittens will kill programmers... The thing is most of us expect the person asking the question here to have done at least a little bit of research into the problem, even if that only extends to I'll Google some of these keywords in the error. That should at least have produced the same advice about those old deprecated functions, but I wanted to reiterate it a bit just to be sure. It can't hurt to know something like that. The fact is, what you considered a simple answer was bad advice, and would have just taught more people that those old functions are fine, when in-fact they are not. I think it's very important to make people aware of security concerns, especially if they're a beginner with the language. Thanks, Ash http://www.ashleysheridan.co.uk Ash, I am not trying to single you out and i hope that is not how you have taken this conversation. While i agree with you on the security of mysql and BTW (Kittens are monsters). The question clearly showed they have NO experience in db connectors. I felt to over complicate the problem by pushing them into another function was not the best approach. Yes they should understand the security risk and i take the reasonability for not fully explaining the ramifications for using such a function. If you knew my staff you would know I am the last person to think old ways is any approach i will accept. I will end the conversation with an apology to person asking the question, because i should have went into more detail and to anyone this conversation has mislead into thinking i think that function is anything BUT outmode.
Re: [PHP] Can't connect to MySQL via PHP
Regardless of the choice of interface to mysql, regardless of the completely harmless but educational tips from Ash, and very deliberately ignoring the un-helpful and extraneous comments of others, I'm wondering how the OP is doing with getting his mysql access working. Haven't heard from him lately. Rick? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
-Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Sunday, January 13, 2013 9:13 AM To: php-general@lists.php.net Subject: Re: [PHP] Can't connect to MySQL via PHP Regardless of the choice of interface to mysql, regardless of the completely harmless but educational tips from Ash, and very deliberately ignoring the un-helpful and extraneous comments of others, I'm wondering how the OP is doing with getting his mysql access working. Haven't heard from him lately. Rick? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jim, I understand it was a credentials issue and all is working fine now. I hope they did take the advice from ash and change the function for security reasons. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't connect to MySQL via PHP
Hi Jim, and all the rest. Thanks for the help. What was throwing me was the EXACT same creds were being used to connect via Navicat… but not when using PHP. Could not figure it out. So I zapped gremlins in BBEdit on my test file.. which had literally no more lines than what I posted to this list… not expecting it to work since the code was so simple and I saw nothing out of place…but it did, I connected after that. So some character had to gotten placed into the file when moving from one hosting provider to another. Thanks to all who offered help regarding the connection issue. --Rick On Jan 13, 2013, at 12:12 PM, Jim Giner jim.gi...@albanyhandball.com wrote: Regardless of the choice of interface to mysql, regardless of the completely harmless but educational tips from Ash, and very deliberately ignoring the un-helpful and extraneous comments of others, I'm wondering how the OP is doing with getting his mysql access working. Haven't heard from him lately. Rick? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't connect to MySQL via PHP
On January 12, 2013 11:25:58 AM Rick Dwyer wrote: Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1… both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick are navcat and php on the same machine? mysql user accounts can and often do take into account which machine the connection is comming from? $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
-Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
On Jan 12, 2013, at 3:56 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Could not connect: Access denied for user 'user'@'localhost' (using password: YES) Using mysqli_ returns the same error message as well. --Rick --Rick
Re: [PHP] Can't connect to MySQL via PHP
On 1/12/2013 1:28 PM, Rick Dwyer wrote: On Jan 12, 2013, at 3:56 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Could not connect: Access denied for user 'user'@'localhost' (using password: YES) Using mysqli_ returns the same error message as well. --Rick --Rick Isn't that just telling you that the uid is not defined for the proper access to any mysql db? It's been awhile since I set my accesses up so I can't remember. I have one user that I use to do all my connections with. That user is declared for each db with full access. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui
RE: [PHP] Can't connect to MySQL via PHP
admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
On Sat, 2013-01-12 at 19:53 +, Ashley Sheridan wrote: admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk Sorry, just re-read the OP and realised he was using the mysql_* functions. I still stand by my statement of not using them though. People should be advised that the functions are deprecated fully now and are not safe to use. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
Simple test I just did. A simple script that first connects to mysql and then tries to select a db. With a uid/pswd that I just made up for the script, I get the following: Error - Could not connect to database from sql_db_connect Access denied for user 'albany_ginerjm3'@'localhost' (using password: YES) Going into my host's mysql manager, I created the uid/pswd to match what my script has in its code. The next execution returns this: Error - Could not select database in sql_db_connect Access denied for user 'albany_ginerjm3'@'localhost' to database 'albany_jgfiles' Going back to my mysql manager, I added the new user to the db that I am trying to select. No more error messages. I would check that the user is defined to access the db that you are trying to use, if not all the dbs you have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't connect to MySQL via PHP
I agree. Thanks Ash. Always good recommendations from your end. On Sat, Jan 12, 2013 at 3:03 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Sat, 2013-01-12 at 19:53 +, Ashley Sheridan wrote: admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk Sorry, just re-read the OP and realised he was using the mysql_* functions. I still stand by my statement of not using them though. People should be advised that the functions are deprecated fully now and are not safe to use. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com wrote: As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. It's not this php list. It's the php developers. mysql* functions are set to be removed in a release coming soon. Time marches on. mysql* functions were written first, then the mysqli* functions were written. mysql* is old, out of date, and not begin supported. Should not have written it? Maybe? But maybe no libraries should have been written, nothing should move forward, better ways should not have been found. Maybe you want to do your computing using pebbles, too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php