Page 1 of 1

config phpmyadmin with existing mysql server

PostPosted: 25. July 2009 23:48
by pk2009
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.

Re: config phpmyadmin with existing mysql server

PostPosted: 25. July 2009 23:54
by Wiedmann
please outline the steps to connect to an existing mysql server through php.

through PHP (your own scripts) or phpMyAdmin?

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 04:01
by pk2009
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.

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 13:10
by Wiedmann
$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.

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 15:59
by pk2009
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?

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 16:25
by pk2009
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.

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 16:45
by pk2009
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.

Re: config phpmyadmin with existing mysql server

PostPosted: 26. July 2009 20:20
by Wiedmann
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.

Re: config phpmyadmin with existing mysql server

PostPosted: 28. July 2009 15:51
by pk2009
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);