Jump to content

Connection String Problem


ballouta

Recommended Posts

Hi,

I've created a new MYSQL Database, username and password.

and I set the cnnection string for my PHP code query as follows:

 

<?php
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database name");
?>

 

But i have this problem:

I cannot connect to the database because: Access denied for user 'XXX'@'localhost' (using password: YES)

 

I sent a ticket for the hosting company (http://www.sectorlink.com), they gave me this link:

http://www.connectionstrings.com/mysql

 

butI can't understand this line!

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

never saw such connection string

 

May you help please

Link to comment
https://forums.phpfreaks.com/topic/175620-connection-string-problem/
Share on other sites

<?php

 

$connect= mysql_connect('localhost', 'mysql_user', 'mysql_password');

if (!$connect) {

    die('Not connected : ' . mysql_error());

}

 

// make foo the current db

$db_selected = mysql_select_db('foo', $connect);

if (!$db_selected) {

    die ('Can\'t use foo : ' . mysql_error());

}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.