Forum Moderators: coopster

Message Too Old, No Replies

Connecting to ofline database

         

DScoffers

11:24 am on Aug 22, 2006 (gmt 0)

10+ Year Member



I've installed Xampp (Apache, PHP, mySQL, phpMyAdmin), but I can't seem to connect to the database. ("Unable to select database")

I have an online site and I want to set this up as a copy so that I can develop offline.
ONLINE - I went to phpmyadmin and did export database. I copied the sql output and input it to my OFFLINE phpmyadmin.
The database was created and I can browse the database fine.

In each ONLINE .php file there is an include link to dbinfo.php which includes the logins, passwords and mysql_connect commands.

I have changed the login and password information in the OFFLINE config.inc.php.
I get the error message "Unable to select database"

When I try and change any of the info in the dbinfo.php, it says

"Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'myusername'@'localhost' (using password: YES) in C:\Program Files\xampp\htdocs\ref\dbinfo.php on line 7
Unable to select database

This makes me believe that I have the username and password right, but for some other reason I can't connect to the database.
Is that true?
Do the username&password details get moved across with the db?

I'm a real beginner here, and I've checked that all relevant settings between ONLINE and OFFLINE match in config.inc.php, (I think) but I don't know what else to try.
All help appreciated.

henry0

1:18 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do not know Xampp

but a GREAT one is WAMP5
it has everything you need and install comes easy

Back to your actual problem: Try to go in PHPmyAdmin, at the very opening page
Select “Privileges”
Add a new user
Create the new user and do not restrain any access (OK all)

Then try to conn to your DB by using the new ID

<Edit>
BTW was it an auto install or did you install each elements?
</Edit>

DScoffers

3:53 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



Xampp is pretty similar to WAMP5 I think.
It comes with a full auto-installer and allows you to check which services you want installed/manually started.
I have checked the Control Panel and all services are runnning properly.

OK, I've created a new user called test@%. (I presume the "% means any host and not just localhost.)

I've set it up with ALL privileges, (I presume I don't need to set it up on the database level, just the user level.)

I'm using a simple file of:

<?
$username="test";
$password="test";
$database="mydatabase_db";
error_reporting(E_ALL);

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
?>

And it still gives the error of "Unable to select database"

So now I've created a new database via phpmyadmin.
When I try to connect to that with the new fully privileged user I still get the same error.

Where else do I need to set the username and password for accessing the database?

coopster

5:52 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Which MySQL version are you running? It may be this known issue ...
[webmasterworld.com...]

DScoffers

11:24 am on Aug 25, 2006 (gmt 0)

10+ Year Member



Apache 2.2.2
MySQL 5.0.21
PHP 5.1.4
phpMyAdmin 2.8.1
XAMPP Control Panel Version 2.3
FileZilla FTP Server 0.9.16c

These are the versions of each of the components installed with Xampp.

I'd be surprised if they released 2 versions which conflict with each other.
Really struggling with this one.

henry0

12:05 pm on Aug 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Regardless of the new PW and UN the initial setup is I presume still enabled

try connecting by using localhost, root as a UN and for PW use " " (empty, no password required)

<<<
I've set it up with ALL privileges, (I presume I don't need to set it up on the database level, just the user level.)
>>>>>

How did you set the privileges if not at DB level?