config phpmyadmin with existing mysql server

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

config phpmyadmin with existing mysql server

Postby pk2009 » 25. July 2009 23:48

hello,

I have an existing mysql server (port 3307) on my computer and i want to be able to use php. i can connect to the xampp mysql server (port 3306) but no luck connecting to the existing mysql server (port 3307). i have tried messing w/ the config files for xampp mysql and phpmyadmin to no avail.

can someone please outline the steps to connect to an existing mysql server through php. thanks.
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40

Re: config phpmyadmin with existing mysql server

Postby Wiedmann » 25. July 2009 23:54

please outline the steps to connect to an existing mysql server through php.

through PHP (your own scripts) or phpMyAdmin?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: config phpmyadmin with existing mysql server

Postby pk2009 » 26. July 2009 04:01

i am trying to connect to the mysql server through a php file with:
$mysqli = @new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

i am not sure if this command goes through phpmyadmin.

also for the DB_HOSTNAME - i have tried 'localhost:3307' and it came back with the error message unknown host.
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40

Re: config phpmyadmin with existing mysql server

Postby Wiedmann » 26. July 2009 13:10

$mysqli = @new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
also for the DB_HOSTNAME - i have tried 'localhost:3307' and it came back with the error message unknown host.

According to the manual "http://de2.php.net/manual/en/mysqli.connect.php", the port is configured with the fifth parameter.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: config phpmyadmin with existing mysql server

Postby pk2009 » 26. July 2009 15:59

thanks for the comments so far.

so i tried using:
$mysqli = @new mysqli('localhost', 'root', 'password', 'db_name', '3307');

i still received the error message - Can't connect to MySQL server on 'localhost' (10061)

i tried turning off the xampp mysql and got the same result.

do i even have the right mysql server name for a local copy of mysql?
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40

Re: config phpmyadmin with existing mysql server

Postby pk2009 » 26. July 2009 16:25

also i have tried to change the mysql config file in the xampp folder but i cant find the sock file for my local copy of mysql. is this what i need to change to get it to connect.
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40

Re: config phpmyadmin with existing mysql server

Postby pk2009 » 26. July 2009 16:45

ok, i just found a big problem. i had reinstalled xampp and apparently it has erased/hidden my original mysql server. i tried connecting to it through the command line with 'mysql -u root -p -P 3307' without any luck. also i used the netstat -an command and i dont see port 3307. well i guess i ll have to use the xampp installed mysql server then.
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40

Re: config phpmyadmin with existing mysql server

Postby Wiedmann » 26. July 2009 20:20

it has erased/hidden my original mysql server.

Hm. That's not possible (regarding the server). But if you have installed your other MySQL server as Windows service, you should not install the XAMPP MySQL as service.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: config phpmyadmin with existing mysql server

Postby pk2009 » 28. July 2009 15:51

thanks for the help. i have solved the problem.

#1 If you uncheck installing mysql with xampp - it installs it anyway.
#2 xampp didnt erase my existing mysql server - it just made it impossible to connect to it.

so to resolve this: i first installed xampp and second installed mysql. Now i am able to access local mysql server in php with $mysqli = @new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PORT);
pk2009
 
Posts: 6
Joined: 25. July 2009 23:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 153 guests