ballouta Posted September 26, 2009 Share Posted September 26, 2009 Hi, I've created a new MYSQL Database, username and password. and I set the cnnection string for my PHP code query as follows: <?php $dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("database name"); ?> But i have this problem: I cannot connect to the database because: Access denied for user 'XXX'@'localhost' (using password: YES) I sent a ticket for the hosting company (http://www.sectorlink.com), they gave me this link: http://www.connectionstrings.com/mysql butI can't understand this line! Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; never saw such connection string May you help please Link to comment https://forums.phpfreaks.com/topic/175620-connection-string-problem/ Share on other sites More sharing options...
ManInBlack Posted September 26, 2009 Share Posted September 26, 2009 <?php $connect= mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$connect) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $connect); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/175620-connection-string-problem/#findComment-925410 Share on other sites More sharing options...
ballouta Posted September 26, 2009 Author Share Posted September 26, 2009 First I have to thank you so much! but i am confused what was the difference between the connection string i used and your string? when i used your connection string, it worked:) Thank you Link to comment https://forums.phpfreaks.com/topic/175620-connection-string-problem/#findComment-925413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.