...

View Full Version : How to determine which port MySQL is running on (LocalHost)?



Shaitan00
03-28-2009, 05:00 AM
I've been dealing with this issue of PHP connecting to MySQL for a few days now, working step-by-step to try and identify the issue.
(again - works fine from the console application - I can query, create, insert, update, etc...)

Last thing I was looking into is to confirm the PORT mysql is running on, so to see if maybe I am just looking in the wrong place.
So, how do I know? Is there a way to find out?
I added the following to MY.INI:
[mysqld]
port = 3306
Didn't seem to make a difference...
Is there a way to confirm if this is the MY.INI file that is being used/loaded when I start the MySQL database? I did a search on my HDD and the only MY.INI found is in the H:\DEVEL\MYSQL folder, and I could not find any "my.cnf" anywhere.
Does this path need to be included as a environment variable?

I tried running "mysqladmin variables -u root -p" and seeing what it lists, the only things that seemed relevant are:
| hostname | MyComputer (valid machine name)
| named_pipe | ON
| port | 0
| report_port | 3306
| report_user |
Is there anything else I should get?
Is there anyway to confirm which MY.INI it is loading?
Why is PORT 0? And what is REPORT_PORT?


When I start the MySQL database and check the Data\MachineName.err file I see the following:
090327 22:06:45 InnoDB: Started; log sequence number 0 46409
090327 22:06:45 [Note] Event Scheduler: Loaded 0 events
090327 22:06:45 [Note] H:\Devel\MySQL\MySQL Server 5.1\bin\mysqld: ready for connections.
Version: '5.1.32-community' socket: '' port: 0 MySQL Community Server (GPL)
I assume this means it is running on PORT 0? How does that make any sense?


Some of the things I've already tired (maybe it will help you guys figure out what my next step should be):

C:\>telnet localhost 3306
Connecting To localhost...Could not open connection to the host, on port 3306: Connect failed

C:\>telnet localhost 0
Connecting To localhost...Could not open connection to the host, on port 0: Connect failed

MySQL runs fine from the command line
And the User is "root" with password "pass"
Service is running (started it manually - and console application works)

mysqladmin.exe -u root -p ping
Enter password: **
mysqld is alive

I added BIN\MySQLd.exe to the firewall options @ opened port 3306 on the Firewall - didn't touch my router (using localhost - I imagine I don't need to go that far).


Running it in PHP5 always gives me the following error:
$this->connection_id = @mysql_connect('localhost', 'root', 'pass');
>> Can't connect to MySQL server on 'localhost' (10061)


Absolutly any ideas or help would be greatly appreciated, this is causing some huge delays for my development project (school).
Thanks,

bdl
03-28-2009, 08:27 AM
I see you're still battling this issue.

Note one thing in your variables return result:
named_pipe | ON

You're still running pipes and not networking. You need to check your config file again for the 'named-pipes' directive, comment it out or delete it, and restart MySQL.

As I mentioned in a previous post in the PHP forum, PHP's MySQL extensions can only connect via TCP/IP, not a pipe.

As you might expect, much relevant information can be found in the MySQL manual online, particularly in the section marked 'Windows Troubleshooting (http://dev.mysql.com/doc/refman/5.1/en/windows-troubleshooting.html)'. On that page is a link that explains all about the option file (http://dev.mysql.com/doc/refman/5.1/en/windows-create-option-file.html).

Shaitan00
03-28-2009, 09:00 AM
Most amazing thing - did Uninstall & ReInstall of MySQL and now everything works fine ... who would have guessed ... thanks everyone for their help !!!

FeralReason
04-16-2009, 04:20 PM
I did an uninstall and reinstall also (XAMPP) but my problem of MySQL not starting strangely re-emerged. Explicitly opened 3306 as a service port for MySQL in my firewall (McAfee) but this has not solved the problem.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum