Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2005
    Thanked 1 Time in 1 Post

    Question How to determine which port MySQL is running on (LocalHost)?

    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:
    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).

  • #2
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Camarillo, CA US
    Thanked 83 Times in 82 Posts
    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'. On that page is a link that explains all about the option file.

  • #3
    New Coder
    Join Date
    Jan 2005
    Thanked 1 Time in 1 Post
    Most amazing thing - did Uninstall & ReInstall of MySQL and now everything works fine ... who would have guessed ... thanks everyone for their help !!!

  • #4
    New to the CF scene
    Join Date
    Apr 2009
    Thanked 0 Times in 0 Posts
    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.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts