can't connect to mysql

Status
Not open for further replies.

psyb0rg

Baseband Member
Messages
39
this is the error i get:
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'admin'@'localhost' (using password: YES) in F:\Server\Apache2\htdocs\testsql.php on line 3


and line 3 is: $mysqli = mysqli_connect('localhost','admin','admin', 'demo');

mysql's username and password are 'admin' . I also tried using my Windows username and passsword. I didn't work either.

Im using Apache2, PHP5 and MySQL 4.1
 
http://www.devshed.com/c/a/MySQL/Building-a-Simple-Affiliate-System-in-PHPMySQL/1/

This is little bit how I do my coding

I have a php file that holds all my login info then use "include" statement to connect to my db.

<?
$dbhost = "local"; // database hostname
$dbuser = "merz"; // database username
$dbpassword = "mypassword"; // database password
$dbname = "blah"; // database name
?>

I save that as a file like connect.php

Then when I code another page I do something like this:

<?
include("connect.php");

$dbh=mysql_connect ($dbhost, $dbuser, $dbpassword) or die ('I cannot connect to the database because: ' . mysql_error());

mysql_select_db ($dbname,$dbh);
 
I tried connecting through another user, but it didn't.
And Merz I also tried your method. Its similar to what I used. Didn't make a difference.
I used to connect to mysql easily some time back.I left it for a few months and now with the new versions, I can't seem to connect.
 
Try using 'root' as user and for the password use the one you typed in when you installed MySQL. Also you could remove the demo bit and see what happens without it
 
I reinstalled everything and setup ymsql WITHOUT any username or password. Its working .

Another problem:

Fatal error: Call to undefined function mysql_create_db()

what is this all about?
 
Status
Not open for further replies.
Back
Top Bottom