Accessing the MySQL server spawned by CQRlog

Posted by Nate Bargmann on Mon, Aug 15, 2011

Since version 1.0.0~alpha1 CQRlog has used the ubiquitous MySQL database.  By default MySQL is used as an embedded database and the individual databases are stored under ~/.config/cqrlog/database/  This is all well and good and has the advantage of removing the need of a CQRlog user doing any sort of database admin type stuff.  It’s easy and works well.  My goal is to be able to access the database from outside of CQRlog for my own purposes.

After a bit of sleuth work I found that CQRlog starts a mysqld process that listens on TCP/IP port 64000.  The only problem is that when using the mysql utility to connect to that port I could not see any cqrlog named databases.  The ps ax | grep mysql command revealed that the  mysqld process is started with the --datadir option which points to the database directory above, but I could find no similar option for the mysql utility.  I finally stumbled upon a reference for using the file socket as in:

  mysql -S /home/USER/.config/cqrlog/database/sock

which did the trick!  I can now browse the databases, for better or worse.

Notes

  • mysqld started by CQRlog has the --skip-grant-tables option passed to it so no user name or password is needed.
  • CQRlog must be running for the file socket to be available.
  • A system wide MySQL database process is not used by CQRlog.  Perhaps that will be available in the future.

I’m sure there is much more to learn about all of this!