Menu

#232 setting port to MYSQL_PORT breaks my.cnf setting

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2007-07-26
No

In _mysql.c, port is set to the default value of MYSQL_PORT. Problem is, if a value other than 0 is passed to mysql_real_connect, that value will override any value set in my.cnf or ~/.my.cnf, effectively meaning that non-standard port settings do not work via read_default_group in python.

The fix is merely to set port=0, which will cause mysql to use the compiled in port number as a default if it is not set elsewhere.

Discussion

  • Monty Taylor

    Monty Taylor - 2007-07-26

    Logged In: YES
    user_id=43580
    Originator: YES

    === modified file 'trunk/MySQLdb/_mysql_connections.c'
    --- trunk/MySQLdb/_mysql_connections.c 2007-02-11 04:37:29 +0000
    +++ trunk/MySQLdb/_mysql_connections.c 2007-07-26 22:39:03 +0000
    @@ -15,7 +15,7 @@
    #endif
    char host = NULL, user = NULL, passwd = NULL,
    db = NULL, *unix_socket = NULL;

    • uint port = MYSQL_PORT;
    • uint port = 0;
      uint client_flag = 0;
      static char *kwlist[] = { "host", "user", "passwd", "db", "port",
      "unix_socket", "conv",
     
  • Andy Dustman

    Andy Dustman - 2012-09-07

    This got fixed way back in rev 625, about 3 years ago

     

Log in to post a comment.

MongoDB Logo MongoDB