kadamsurekha Posted March 9, 2007 Share Posted March 9, 2007 hi friends! i m getting this foll msg. Could not connect: Access denied for user 'mobis'@'localhost' (using password: NO) if i try to connect to mysql. my sql details r:- user - mobis host - localhost password - empty i hav grant all the rights to the database. but still getting error. wht may be the problem? Link to comment https://forums.phpfreaks.com/topic/41961-mysql-connection/ Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 show your mysql connection code please. Link to comment https://forums.phpfreaks.com/topic/41961-mysql-connection/#findComment-203448 Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 Any way this is correct way Your notice the space on the password tells mysql there no password. "" WRONG " " CORRECT <?php $db=mysql_connect("localhost" , "username" , " "); mysql_select("database_name",$db); <? Link to comment https://forums.phpfreaks.com/topic/41961-mysql-connection/#findComment-203449 Share on other sites More sharing options...
kadamsurekha Posted March 9, 2007 Author Share Posted March 9, 2007 hello my code is:- <?php $link = mysql_connect('localhost:3306', 'mobis', ''); if (!$link) { die('Could not connect: ' . mysql_error()); } else { echo "connection"; } mysql_close($link); ?> if i try with this code it is fine with my server. but when i try for my online site it gives me the foll msg:- Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mobis'@'localhost' (using password: NO) in /home/httpd/vhosts/mobishoptalk.fritzdsouza.com/httpdocs/wel.php on line 99 Could not connect: Access denied for user 'mobis'@'localhost' (using password: NO) line 99 : $link = mysql_connect('localhost:3306', 'mobis', ''); i hav hosted my site using filezilla server. do i need any configurations there or in mysql? can u tell me the soln thx Link to comment https://forums.phpfreaks.com/topic/41961-mysql-connection/#findComment-203458 Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 $link = mysql_connect('localhost:3306', 'mobis', ' '); WRONG '' CORRECT ' ' <<<<<<<<<<<<< a space Link to comment https://forums.phpfreaks.com/topic/41961-mysql-connection/#findComment-203501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.