php - phpMyAdmin refuses MYSQL connection - How to fix it? -


i'm creating web application in php , need connect database , retrieve information it. database in question being hosted on phpmyadmin. i'm using following php code connect it.

//attempt connect database $conn = mysql_connect('localhost', 'my_username', 'my_password') or die (mysql_error());  //tell user if successful echo "connection successful!";  //close connection mysql_close(); 

when run website, produces following sql error:

"no connection made because target machine actively refused it."

i'm sure username , password spelled correctly , believe 'localhost' server name need use. there different mysql_connect command need use phpmyadmin? if not, how can solve problem?

edit:

upon publishing website microsoft azure (where need host it), i've found produces different error:

"an attempt made access socket in way forbidden access permissions."

how able fix error? or fixing original error solve one?

  1. do not use mysql_* functions. deprecated. more information, see question: why shouldn't use mysql_* functions in php?

  2. phpmyadmin hosts nothing; php application connects database own app attempting do.

  3. take @ phpmyadmin config file , ensure using same host. try same username/password. if succeeds, it's advisable set dedicated username/password application. can done within phpmyadmin on privileges page.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -