problem connecting to remote mysql database using php

If I open up a cmd shell and run

>mysql --host= --port=1234 --user=myuser --password=mypassword mydb

I can successfully connect to the remote mysql database.

But if I create a php page on my localhost containing

$hostname = "";
$username = "myuser";
$password = "mypassword";
$dbname   = "mydb";
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");

I get the following error:

Error: could not connect to database

Can anyone explain what might be causing the problem here?

mysql_error() => mysqlnd cannot connect to MySQL 4.1+ using old authentication


Auth problems are a known issue with PHP 5.3 and older versions of MySQL. Check this:

maybe in your php.ini parameter sql.safe_mode is "1"?

sql.safe_mode boolean 

If turned on, database connect functions that specify default values will use those values in place of supplied arguments. For default values see connect function documentation for the relevant database.

Need Your Help

Scala Play 2.0. Compilation error: IO error while decoding

scala playframework playframework-2.0 sbt multi-module

I downloaded multi-module Scala project from GitHub (, and one of the module is Play 2.0 module. So I can run whole application using SBT's run command on ...

Store String Array In appSettings? .net web-config app-config

I'd like to store a one dimensional string array as an entry in my appSettings. I can't simply separate elements with , or | because the elements themselves could contain those characters.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.