stualk Posted January 15, 2007 Share Posted January 15, 2007 Hi,I'm having problems connecting to databases since I upgraded my server. I used to use PHP version 4.something and now suddenly i'm on version 5.5 and can't connect to any databases using the same connection code as before. Here's the code i'm using:[code]<?mysql_connect("www.url-here.co.uk", username, password);mysql_select_db(db_name_here);?>[/code]And here's the error i'm getting:"Warning: mysql_connect() [function.mysql-connect]: Access denied for user: '[email protected]' (Using password: YES) in /home/vhost/net-strategy.co.uk/html/psl/news/database.php on line 2"Can anyone see what could be wrong with my code? Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/ Share on other sites More sharing options...
OOP Posted January 15, 2007 Share Posted January 15, 2007 make sure that both user name & password are correct Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161014 Share on other sites More sharing options...
trq Posted January 15, 2007 Share Posted January 15, 2007 Um... PHP currently is only at version 5.2.0, you sure you don't meen you upgraded mysql? The error meens you dont have permission to connect to the database server. It is a mysql issue, not that of PHP. Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161015 Share on other sites More sharing options...
stualk Posted January 15, 2007 Author Share Posted January 15, 2007 It's probably version 5.2 then, sorry about that! I've lost my notes!So do you think there's a problem with the server then if I can't connect to the database? The username, password, db name and address are definitely correct. Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161017 Share on other sites More sharing options...
trq Posted January 15, 2007 Share Posted January 15, 2007 Well, its saying access denied, thats gotta meen something. When you say you upgraded your server, its still the same server is it? I meen, you didn't change ip or anything? Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161022 Share on other sites More sharing options...
stualk Posted January 15, 2007 Author Share Posted January 15, 2007 No we've upgraded to a newer server so it does have a different IP address. Does that cause a problem? I've never had to connect to a db on a different server before so i'm unsure. Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161024 Share on other sites More sharing options...
trq Posted January 15, 2007 Share Posted January 15, 2007 You need to make sure your database user has permissions to connect from your new server. eg; By default, mysql will usually only let you connect from 127.0.0.1 or localhost.Can you login to the database server via ssh? Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-161097 Share on other sites More sharing options...
stualk Posted January 16, 2007 Author Share Posted January 16, 2007 I'm not sure how to login to the database via SSH to be honest. However I have managed to login to the actual server using SSH and turn global variables on by editing the php.ini file. Is there anything else maybe I could edit in the php.ini file that would solve my connectivity issues? My host tells me that the permissions are set correctly for me to connect from my new server. Link to comment https://forums.phpfreaks.com/topic/34231-db-connectivity-issues-using-php-55/#findComment-162381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.