Niels Horn's Blog

Random thoughts, tips & tricks about Slackware-Linux, Lego and Star Wars

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 :)

The patch

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[0];
-  if (handle_options(&argc, &argv, my_long_options, get_one_option))
-    exit(-1);
   if (!argv[0] || !argv[1] || (pid = atoi(argv[0])) <= 0 || (t= atoi(argv[1])) <= 0)
     ret = mysqlcc_main(argc, argv);
-  free_defaults(save_argv);
   return ret;
 }

The patch can also be downloaded here.

It works

After patching and building, I could use mysqlcc on my mysql 5.5 server:

mysqlcc_5.5
Just remember that it will not handle any command line option after this patch, not even "-v" to see the version...

(*) My and Maria are both daughters of Ulf Michael Widenius, the "father" of both databases.

Bookmark and Share

This entry was posted on Monday, December 19th, 2011 at 20:02 and is filed under mysqlcc. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “mysqlcc revisited – making it work with mysql 5.5”

  1. aguai Says:

    Please send a repair mysqlcc-1.0.1 software supports win32 thing to me? Thank you! My email address is
    aguai2008@qq.com

  2. Niels Horn Says:

    I’m sorry but I don’t use Windows at all, so I have no way to build an executable for you.
    You will need to find someone who can apply the patch and compile it on a Windows machine…

  3. robert revolver Says:

    I have a problem with -> segfault at 3b0 ip b73bef2c sp bfacdcd0 error 4 in libmysqlclient.so.18.0.0[b739c000+29d000]
    I have mysql 5.5.24 installed, and i use the mysql client, iam looking for a patch. your patch is good for my problem?

Leave a Reply



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

It may take some time for your comment to appear, it is not necessary to submit it again.