You are here:

MySQL/Inserting Data to MySQL Server


I have to insert the data in mysql server, when I am inserting it in localhost it is working but when I insert it in remote host it is giving an error :
"Unable to connect to any of the specified MySQL hosts."

working connection string is :

not working connection string is :

Dear Sir

If the script is on the same server that the database is on it is always localhost to connect to the database. However if you wish to connect from an outside source you are correct in using the ip address.

There are always configuration options required on the server. You have to configure you server to allow remote connections to the mysql database first. As default these are rejected for security.


All Answers

Answers by Expert:

Ask Experts


stuart gregory


PHP html, xhtml, css coding and MySQL


My experiance is all first had as I am web developer and I have, and do build many websites all using php and mysql. This ranges from building a simple search engine to secure php login scripts. Some websites like are complete database driven websites.

I have a large number of websites which I host and maintain, such as.

Web application development. (Open University) BSC Honers Computing and development (Open University)

©2016 All rights reserved.