You are here:

MySQL/Inserting Data to MySQL Server

Advertisement


Question
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 :
"SERVER=localhost;DATABASE=inborn_talent;UID=root;PASSWORD=;"

not working connection string is :
"SERVER=173.192.76.44;DATABASE=inborn;UID=inborn;PASSWORD=inborn;"

Answer
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.

MySQL

All Answers


Answers by Expert:


Ask Experts

Volunteer


stuart gregory

Expertise

PHP html, xhtml, css coding and MySQL

Experience

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 http://www.web-application-development.info are complete database driven websites.

Organizations
I have a large number of websites which I host and maintain, such as. http://www.webreger.com http://www.universalscience.co.uk http://www.modellingelectronics.co.uk

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

©2016 About.com. All rights reserved.