I am having issues connecting to my Xeround database through php. I have successfully connected using JDBC in java, but I'm trying to do it from my website and it is not working.

Here is the php code, it's pretty simple.

<?php
  $con = mysql_connect("DATABASE INSTANCE","USERNAME","PASSWORD");
  if(!$con) {
  die ('Could not connect to mysql' . mysql_error());
}

mysql_select_db("DATABASE TABLE", $con);
?>

The error I get when trying to connect says:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user
'USERNAME'@'192.168.1.1' (using password: YES) in     /www/zymichost.com/s/f/x/sfxol/htdocs/db_connect2.php on line 15
Could not connect to mysqlAccess denied for user 'USERNAME'@'192.168.1.1' (using password: YES)

Does anyone know what this could be? Is it impossible to connect to Xeround using php? If so, does anyone know another database that is hosted free online that allows remote connections?

All help is greatly appreciated.

有帮助吗?

解决方案

Do not use mysql_connect, its deprecated. Try PDO instead: php.net/manual/en/ref.pdo-mysql.php

Also, on Xeround website, there is a tutorial with PDO and mysqli extensions:

http://xeround.com/developers/connecting-your-mysql-application-to-xeround-cloud-database/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top