Cannot connect to mySql database.

Anybody help?
Cannot connect to mySql database.

Get this message:-

Couldn't connect to database
Database not found
PHP Warning: mysql_connect(): Access denied for user: [email protected]' (Using password: NO)


using this:

<?php

$usr = 'PREFIX_USERNAME';
$pwd = 'PASSWORD';
$db = 'PREFIX_DATABASENAME';
$host = 'mysql.jodoshared.com';

$id = mysql_connect($host);
if(!$id)
{
echo "Couldn't connect to database";
}
mysql_select_db($db) or die('Database not found');

It worked on my local server on Windows PC and can connect to database using EMS MySql Manager.
Any idea's

www.wardead.net

Liam

PS: I am a newbie at PHP/MySql
 
It is trying to connect as ODBC because you dont call the variables you set earlier in the script:

$usr = 'PREFIX_USERNAME';
$pwd = 'PASSWORD';
$db = 'PREFIX_DATABASENAME';
$host = 'mysql.jodoshared.com';

$id = mysql_connect($host);


See it is failing at the mysql_connect because it is only sending the hostname, not the user, pass or database.

This should help you get that string right:
http://www.php.net/mysql_connect
 
Hi all,

I have Olate Download 3, first of all it is a very nice, it was working fine...
I have reinstall windows and install The script again, by the first that i put the Database name, password, where the database is. i just press "Continue",
and the page that shows execly:
Code:
[COLOR="DeepSkyBlue"][SIZE="4"][B]Failure[/B][/SIZE][/COLOR]
[COLOR="DeepSkyBlue"]You must correct the error below before installation can continue:[/COLOR]


Database Error: No database selected

[COLOR="DeepSkyBlue"]Before you try again you will need to delete the tables created by the installer,
which have the prefix "downloads_".[/COLOR]

[URL="javascript: history.go(-1)"]Click here to go back.[/URL]
But the Database works fine, other script wont work either but i can log in the MYSQL and add and remove things...

Alexw
 
I have two seperate sights running from the same server both using the same installation of MySQL. The other website works fine and can interact with the MySQL installation without any problems.
I can access MySQL using the command line with: mysql -u root -p: ***** and the login script details within the database.php match the username and password used to access the MySQL database via command line.
I would welcome any thoughts in troubleshooting this confusing issue.
 
Cannot connect to mySql database

Je ne saurais pas ten dire davantage, je nai pas de serveur PostGreSQL dinstallé pour faire des essais et encore moins JDBC

Mais il y a peut-être du coté de JDBC justement des informations à inscrire quelque part, un dsn sur lequel JDBC va se baser pour établir la connexion ?
 
Back
Top