Changing the mySQL Port Number

Help
2008-09-19
2013-01-16
  • Wes Cruickshank

    Wes Cruickshank - 2008-09-19

    Folks,

    Can you please help ? My ISP has and older version of mySQL running on the default port 3306. WebCollab requires 4.1.x. My does not have 4.1.x install, but they do have 5.x running on port 3307.

    How can I change or configure WebCollab to connect to port 3307 for mySQL instead of the default port of 3306 - short of re-writing the code ?

    Thanks,
    Wes

     
    • Andrew Simpson

      Andrew Simpson - 2008-09-20

      Hmm... haven't encountered this problem before, but the solution is easy.

      During setup, set the 'database host' to be: localhost:3307, or if they have MySQL on a different host: some.other.host:3307.
       

       
      • Wes Cruickshank

        Wes Cruickshank - 2008-09-20

        I tried defining the mySQL server as localhost:3307 but no success. This is the database setup in my config file .....

        ---------------
        /DATABASE OPTIONS

          define('DATABASE_NAME', "cruicksh_webcollab" );
          define('DATABASE_USER', "webcollabusr1" );
          define('DATABASE_PASSWORD', "wc_user1" );

          //Database type (valid options are "mysql", "postgresql", "mysql_innodb" and "mysqli")
          define('DATABASE_TYPE', "mysql" );

          //Database host (usually "localhost")
          define('DATABASE_HOST', "localhost:3307" );

         
        ----------------

        With this configuration, I get the following error ...

        :: No database connection
        Sorry but there seems to be a problem in connecting to the database server
        Direct file access not permitted

         
    • Andrew Simpson

      Andrew Simpson - 2008-09-20

      Well, that's very interesting.  Are you sure that the host is 'localhost'?

      Two things:  The message 'Sorry but there seems ...' is definitely due to a database connection failure. 

      The other message 'Direct file access ....' is not normal, nor related to the database.  This could be another (unrelated) problem.  Probably due to accessing files in the wrong way for some reason.

      The PHP Manual says this:

      " server

          The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for the localhost.

          If the PHP directive mysql.default_host is undefined (default), then the default value is 'localhost:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used."

      I've tried to simulate this on my local machine, and it was very interesting.  The port number can be _any_ number (i.e. it is ignored).  I tried a fully qualified domain name for host, but it wouldn't work.  Nor would 127.0.0.1 (localhost) work.  This is probably because my MySQL is configured for local UNIX sockets.

      Looking in the php.ini file, I can see more settings that affect Mysql host / port.

      I think you are going to need the help of your ISP on this one, since you won't be able to know or edit MySQL configuration or php.ini.

       
      • Wes Cruickshank

        Wes Cruickshank - 2008-09-20

        What makes this more puzzling, I have another application installed on the same domain/ISP account connecting to the same Db successfully. The only difference is, that application allow me to specify the port number in the installation setup. 

        It appears they are doing something behind the scenes to put the hostname (localhost) together with the port number. I not sure how !

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks