A mysql_connect problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

A mysql_connect problem

Postby CelticCross » 18. November 2008 22:32

This is possibly a silly error, but I am unable to get the php code to connect to my data base, the code is as follows :

$cxn = mysqli_connect( "localhost", "Grayhill", "D0wnend", "GrayhillDataBase" ) or die ("Couldn't connect to server.");

The entry in the config.inc.php file is as follows :

<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 2.11.9.2 setup script by Michal ÄŒihaÅ™ <michal@cihar.com>
* Version: $Id: setup.php 11423 2008-07-24 17:26:05Z lem9 $
* Date: Tue, 18 Nov 2008 17:55:54 GMT
*/

/* Servers configuration */
$i = 0;

/* Server localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';

/* Server localhost (config:Grayhill) [2] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'Grayhill';
$cfg['Servers'][$i]['password'] = 'D0wnend';

/* End of servers configuration */

$cfg['blowfish_secret'] = '4922cc59b16e51.63372312';
?>

And the error is :

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Grayhill'@'localhost' (using password: YES) in C:\xampp\htdocs\index\Login\LoginScript.php on line 24
Couldn't connect to server.

The application status is as follows :

XAMPP Application Status 1.1.1.0
Apache State 1 Service 1 Start 1 Thread 0 Op 0 Port 60
Mysqu State 1 Service 0 Start 1 Thread 160 Op 0 Port 3306

The Apache / php for all the other pages is running fine, what have I done wrong with the MySQL / Php interface, I havr run out of ideas.
CelticCross
 
Posts: 3
Joined: 17. November 2008 22:27

Postby Wiedmann » 18. November 2008 23:16

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Grayhill'@'localhost' (using password: YES) in C:\xampp\htdocs\index\Login\LoginScript.php on line 24

Did you have a user "Grayhill" with the password "D0wnend" in MySQL?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby CelticCross » 19. November 2008 10:23

Yes, see the entry above starting $cxn =

From my unedrsanding of the user name and passwords requirements, thay should be OK
CelticCross
 
Posts: 3
Joined: 17. November 2008 22:27

Postby Wiedmann » 19. November 2008 10:54

Yes, see the entry above starting $cxn =

That's the config file for phpMyAdmin, which is just a script like your own, and have nothing to do with the users you have in MySQL...
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby CelticCross » 19. November 2008 11:07

I new I was doing something wrong, I take it that I can set up the users in MySQL using phpMyAdim or have I miss understood the manuals again. :?
CelticCross
 
Posts: 3
Joined: 17. November 2008 22:27

Postby Wiedmann » 19. November 2008 11:43

I take it that I can set up the users in MySQL using phpMyAdim or have I miss understood the manuals again.

Well, revert your changes in "config.inc.php".

Open phpMyAdmin in your browser, go to "Privileges" and add a user in MySQL. (and don't change the user which phpMyAdmin itself is using for the connection to MySQL. phpMyAdmin is just a simple PHP script.)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 77 guests