PDA

View Full Version : QSqlDatabase default MySQL unix socket path



daggilli
21st September 2008, 20:55
I don't know if this is an FAQ (I couldn't find it on Trolltech's site).

Is there a way to programmatically specify where a MySql database instance should look for the Unix socket it uses to connect to the server? QSqlDatabase:: open() seems to expect it to be in /var/run/mysqld/mysqld.sock whereas MySql itself (at least on my machine) creates the socket as /tmp/mysql.sock. I can make a symlink of course, but if I were running multiple instances of a MySql server on a single platform, it would be nice to be able to tell Qt where to connect.

If this isn't possible, it might be a good idea for future releases to add it as an option to QSqlDatabase::setConnectOptions().