Opened 15 years ago

Closed 15 years ago

#1697 closed enhancement (fixed)

Non-default MySQL port support

Reported by: mrsam@… Owned by: cpinkham
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no


The following patch implements the ability to talk to a MySQL server that listens on a non-default port number.

After I applied this patch, I was able to run mythtv-setup in an account without an existing mythtv configuration. After mythtv-setup couldn't connect using its default, built-in, config, it threw me into the initial database setup screen, where I entered the mysql server host and port, and the other details, after which myth succesfully connected to the server, and created a new schema. I'll be doing more testing, but it looks good.

I also think that it would be helpful to add one more fix to mythdbcon.cpp, something on the order of:

if (dbparms.dbPort && dbparms.dbHostName == "localhost")


"localhost" is a magic value hardcoded into the mysql client library, that causes mysql to try to connect to mysql's default local unix socket, instead of the tcp port. Even if you specify a non-default port to connect to, mysql will still try to connect to the default unix socket. Using an explicit in place of "localhost" avoids this.

There appears to be no way to connect to a non-default unix socket. Qt's MySQL driver always sets the "unix_socket" parameter to mysql_real_connect() to a NULL :-( Unless you are aware of the special meaning of "localhost" to MySQL, you'll be tearing your hair out, trying to get myth connect to a non-default port on localhost.

Attachments (1)

mythtv-0.19.dbport.txt (4.5 KB) - added by mrsam@… 15 years ago.
Patch file

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by mrsam@…

Attachment: mythtv-0.19.dbport.txt added

Patch file

comment:1 Changed 15 years ago by danielk

Milestone: 0.21
Severity: mediumlow
Type: patchenhancement
Version: 0.19head

comment:2 Changed 15 years ago by cpinkham

Owner: changed from Isaac Richards to cpinkham

comment:3 Changed 15 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [11251]) Patch by Sam Varshavchik to allow using a non-default port for the MySQL DB connection via the 'DBPort' option in the mysql.txt file.

Closes #1697.

Note: See TracTickets for help on using tickets.