mysqlcc revisited – making it work with mysql 5.5
How this all started
About a year and a half ago I wrote a patch to get mysqlcc (”MySQL Control Center”) to build with newer versions of mysql and the gcc compiler. This post can be found here and I’ve received several replies on this blog and through e-mail since.
After mysql 5.5 was released, I received a few questions about getting mysqlcc to work with this new version of the still very popular database.
Personally I have not yet decided if I should stick to mysql – now a commercial product from Oracle – or switch to its really free sister (*) MariaDB or even PostgreSQL.
At first I thought “Are people still using this?” and, together with a complete lack of time, did not do too much with this all.
But the, curiosity caught up with me and I started to do some investigation…
The error messages
Trying to build mysqlcc against mysql 5.5 gives these errors:
main.cpp:(.text+0xae): undefined reference to `my_print_help' main.cpp:(.text+0xcd): undefined reference to `my_print_variables' tmp/main.o: In function `main': main.cpp:(.text+0x1dd): undefined reference to `handle_options'
After some quick “googling” I found out that since mysql 5.5 the libmysqlclient library (libmysqlclient.so.18.0.0) does not export several functions that were exported with the previous versions. A discussion about this can be found here. Basically, they were unofficial and now are hidden functions. They can be exported by altering a CMakeLists.txt file and rebuilding mysql 5.5, but this is not always an option. I did try it and in the end I got it to work, but I was convinced that it was not the right way to fix this. After all, I don’t think Oracle would listen to me and change their library
OK, so I had to patch mysqlcc.
These now “hidden” functions all were related to passing command-line parameters to mysql, like the location of the socket, etc. Most users would never use this (I never have) and simply start mysqlcc from a menu, not from a prompt.
I simply removed all these calls in mysqlcc, resulting in this patch:
--- mysqlcc-1.0.1-src/src/main.cpp 2011-07-08 07:40:01.000000000 -0300 +++ mysqlcc-1.0.1-src_patched/src/main.cpp 2011-12-19 09:31:11.000000000 -0200 @@ -176,13 +176,7 @@ print_version(); printf("usage: %s [options] [database]\n\n", progname); printf("Options:\n"); - my_print_help(my_long_options); -#ifndef WIN32 //Win32 doesn't support load_defaults yet. - print_defaults("my", load_default_groups); -#endif - - my_print_variables(my_long_options); exit(-1); } @@ -192,14 +186,8 @@ int pid = 0; int t = 0; int ret = -1; - char **save_argv; - load_defaults("my",load_default_groups,&argc,&argv); - save_argv = argv; progname= argv; - if (handle_options(&argc, &argv, my_long_options, get_one_option)) - exit(-1); if (!argv || !argv || (pid = atoi(argv)) <= 0 || (t= atoi(argv)) <= 0) ret = mysqlcc_main(argc, argv); - free_defaults(save_argv); return ret; }
The patch can also be downloaded here.
After patching and building, I could use mysqlcc on my mysql 5.5 server:
(*) My and Maria are both daughters of Ulf Michael Widenius, the "father" of both databases.