Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-16-2006, 10:52 AM   #1 (permalink)
 
Newb Techie

Join Date: Mar 2005

Posts: 39

psyb0rg

Default can't connect to mysql

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
psyb0rg is offline  
Old 02-16-2006, 08:00 PM   #2 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 32

Merz

Default

Why is demo in there? Database name?
Merz is offline  
Old 02-16-2006, 08:33 PM   #3 (permalink)
 
Ultra Techie

Join Date: Jul 2005

Posts: 530

TheHeadFL

Send a message via AIM to TheHeadFL
Default

Usually mySQL doesn't allow logins via the admin username.

Create another user and try it.
__________________
Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache)
TheHeadFL is offline  
Old 02-16-2006, 08:37 PM   #4 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 32

Merz

Default

http://www.devshed.com/c/a/MySQL/Bui...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);
Merz is offline  
Old 02-17-2006, 04:08 AM   #5 (permalink)
 
Newb Techie

Join Date: Mar 2005

Posts: 39

psyb0rg

Default

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.
psyb0rg is offline  
Old 02-19-2006, 03:31 AM   #6 (permalink)
Zanjo's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 192

Zanjo is on a distinguished road

Default

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
__________________
Intel Q6600 2.4Ghz SLACR
eVGA 8800GT 512mb Video Card
4GB DDR2-800Mhz RAM
Thermalright Ultra Extreme 120 with Scythe SFlex Fan
160GB Seagate Barracuda 7200.9
500GB Seagate Barracuda 7200.11
22" Viewsonic Widescreen Monitor
3DMark06 Score: 11402
Zanjo is offline  
Old 02-21-2006, 10:59 AM   #7 (permalink)
 
Newb Techie

Join Date: Mar 2005

Posts: 39

psyb0rg

Default

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?
psyb0rg is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On