Building MySQL Workbench from sources on Ubuntu/Debian

To build MySQL Workbench one would need to install dependencies, fetch source code, configure it and actually do a build. Here’s how to do it on a Ubuntu/Debian system

 

1) Get source code

Open the browser and go to http://www.mysql.com/downloads/workbench/

When in that page, select “Source Code” from the select box. Usually the TAR file will do the job, so download the “Generic Linux” option and uncompress it:

$> tar xf mysql-workbench-community-<version>-src.tar.gz

 

2) Install dependencies necessary to build

We’ll need to remove iodbc, if it’s installed

$> sudo apt-get remove iodbc

 

Now, we can install the full set of dependencies needed to build Workbench

$> sudo apt-get install build-essential cmake cmake-data autoconf automake pkg-config libtool libzip-dev libxml2-dev libsigc++-2.0-dev libglade2-dev libgtkmm-2.4-dev libglu1-mesa-dev libgl1-mesa-glx mesa-common-dev libmysqlclient-dev libmysqlcppconn-dev uuid-dev libpixman-1-dev libpcre3-dev libgnome2-dev libgnome-keyring-dev libgtk2.0-dev libpango1.0-dev libcairo2-dev python-dev libboost-dev libctemplate-dev mysql-client python-pysqlite2 libsqlite3-dev libtinyxml-dev swig libvsqlitepp-dev libgdal-dev libproj0

 

3) Prepare to build

Go to the directory where you uncompressed the TAR file

$> cd mysql-workbench-community-<version>-src

Now, create the directory where the build files will reside and go there

$> mkdir wb-build

$> cd wb-build

 

4) Build and install

Build and install Workbench, and optionally set the install prefix (defaults to /usr/local)

$> cmake [-DCMAKE_INSTALL_PREFIX=/usr] ..
$> make
$> sudo make install

If you don’t want to install it on the system directories or don’t have permissions to do so, try to install on the current directory. Be aware that the Workbench launch script must be updated to the proper directories

$> make install DESTDIR=.

 

Notes:

  • You will need swig 1.3 to build WB
  • Antlr 3.4 is needed, but the current release has many bugs. You will need it patched with https://github.com/antlr/antlr3/pull/43 if you don’t want to use the bundled version. Then you’ll need to

          export ANTLR_JAR_PATH=<path_to_antlr_complete_file>

  • Instead of iodbc you can use unixodbc, to do that you need to install unixodbc and add -DUSE_UNIXODBC=True to cmake
  • Ubuntu Packages require unixodbc, so if you’re using it, there won’t be any problem. If you want to use iodbc, you’ll need to build it from source.
  • On a Core2 Quad 2.4 GHz and a 4G of RAM it takes about 30-40 minutes to build Workbench. Also it uses about 5G of hard drive space to build and install.

MySQL Workbench on Ubuntu 11.10

We have seen many reports about broken build and freezes which are experienced on Ubuntu 11.10. While the build fix was pretty simple, the freezes took us a bit more time to hunt them down.

The point is that MySQL Workbench relies on glib’s idle signals which are emitted when Gtk’s main event loop has nothing to do. In Ubuntu 11.10, for some reason, for certain types of windows we use, these idle signals are not emitted cause window drawing code constantly reschedules idle redraws.

The bug report which is related to the freezes and compilation problems is at http://bugs.mysql.com/62347

Here is a link to the patch: is http://bugs.mysql.com/file.php?id=17639

MySQL Workbench, Windows XP and SSH public key auth.

It happens that sometimes you need to access a remote box which supports ssh key authentication. Recently I was trying to reproduce a bug related to SSH public key authentication, so here I would like to share some of my experience.

There will be no explanation of the public key authentication itself here, rather the actual setup and steps to have a public key auth for Windows(client) -> Linux(server) working. Why Windows you would ask? Because interactions for Linux->Linux and for Mac OS X -> Linux simply work using the Unix way, while for Windows you may need some extra actions to do.

 

Setup

What I had at endpoints:

    Linux – Ubuntu 11.04, sshd is set up to deny password auth.
    Windows – well, it is an XP SP3 i386 box. MySQL Workbench 5.2.34+ is installed

First of all I created an encrypted pair of RSA keys, using Linux box’s ssh-keygen. After that the public key was added to ~/.ssh/authorized_keys and the private one was moved to the Windows box.

Naturally my first attempt was to simply specify path to the private key file in the server settings, just as I would do in Linux or OS X.

 

Remote management section

 

That did not work, just as the bug report had said. Moving key to $HOME/.ssh/id_rsa did not help. Could that be that paramiko can not handle openssh keys on Windows, or openssh’s encryption method?

 

Error message on connect via SSH public keys

 

Bazaar has similar issues on Windows, the solution they suggest is to either put keys into .ssh dir, or use pageant tool from PuTTY.  I tried .ssh, that did not work. So the latter way turned into conversion of the openssh private key into PuTTY ppk format. The conversion is done using PuTTYgen, then the key is loaded in the pageant. More details are given in the mentioned bazaar guide Bzr and SSH.

And this worked! Let me sum up the steps:

    1. Generate keys, using either openssh on Linux, OSX, Cygwin, or using PuTTYgen;
    2. Specify private ssh key in the appropriate section of the Workbench’s “Server Instance Editor”;
    3. Add key to pageant tool.
    4. At this moment passwords to unlock keys have to be entered both in MySQL Workbench and the pageant.
    5. Use it…

Workbench and MySQL server at non-standard location in Linux.

Recently I had to test MySQL Workbench against fresh version of the server. Naturally, the default mysql-server was already installed from repository of my Linux distro. So I installed the latest server version into my /opt/server directory. And then I had several points to resolve, for example, how to start detached server process from Workbench Adminstrator; how to detect if the server is running or not, given that there are many of them running; how to stop the server.

Now I will show several workarounds to perform tasks listed in the previous paragraph. Below are the commands I put into Server Instance Editor, there are corresponding text entries labeled: ‘Start MySQL’, ‘Stop MySQL’, ‘Check MySQL Status’:

Staring server – (nohup /opt/server/5.5.9/bin/mysql_safe –defaults-file=/opt/server/5.5.9/my.cnf & disown %1)
Note! the command above must be used including parentheses
Stopping server – kill `cat /opt/server/5.5.9/mysql.pid`
Note! the command contains backticks
Checking MySQL Status – ps ax | wba_filter(/opt/server/5.5.9/my.cnf

Also I had to tweak /opt/server/5.5.9/my.cnf, here is the content of the file:
[mysqld]
port = 3308
basedir = /opt/server/5.5.8
datadir = /opt/server/5.5.8/data
tmpdir = /opt/server/5.5.8

socket = /opt/server/5.5.8/mysql.sock
pid-file = /opt/server/5.5.8/mysql.pid
log-error = /opt/server/5.5.8/mysql.error.log

That is all I had to change to make the server installed in custom location work from WBA.

MySQL Workbench Administrator Plugin

Recently we have released Workbench 5.2.4 Alpha. This version has some new features, and amongst them there is Workbench Administrator plugin or WBA plugin for short.

The plugin aims to ease the managing process of server instances. What we offer with WBA is a simple way to check status, configure and control one server instance. Some parts will resemble discontinued MySQL Administrator.

And here is a short summary of what we will have in WBA:

  • Start/Stop server
  • Edit server configuration (my.cnf)
  • Manage user accounts
  • Monitor user connections
  • Status/Server variables browsing
  • Log browsing
  • Dump/Restore

In this alpha we have implemented a subset, which targets local usage only. Remote management and administration is upcoming. The subset includes:

  • Add new Server Profiles
  • Start/Stop the Server
  • Edit Server Configuration (my.cnf)
  • Monitor user connections
  • Status/Server variables browsing

To launch the plugin you need to run Workbench 5.2.4, register a server instance by double-clicking the Manage Icon. Once the server instance is registered you can double click the icon of the server instance. But for the moment let’s dive into what is important to specify at the server instance creation stage.

Our target is ‘System Profile’ tab of ‘Manage Server Instances’ form. Mostly, the whole process should be simple selecting the right profile. Nevertheless, for now (I hope you still remember it is an alpha release), one of the vitally important things is to check location of ini or cnf file. Also you may check commands used to start, stop and query server status. For example OS X profile has that line to check for status: ps -cxa | grep mysqld.

All the commands specified in these entries are run as a sub-processes and sometimes they may require super-user privileges, for that purpose there is ‘use sudo’ checkbox. Normally, command run has exit code which WBA checks for to determine success of failure of the command.

When adding a new Server Profile you also need to select a Connection to the server (You should create that connection in the Connection Management dialog first). That will allow you to browse the Connections and Server Variables in the WBA. It will also be used to update the Server Status periodically every second and show the current state (that is in next alpha).

The way to change the my.cnf/my.ini config file is pretty straightforward. First, if you want a value to be written to the config file, you have to enable the checkbox left to each option. After all changes have been made, you can either press Apply or Discard button. Apply will display a Dialog which shows several things: what has changed, resulting file, commands which are used to save file. If changes are correct, press Apply on the form. That is it.

Stay tuned for the updates on WBA topic.

MySQL Workbench progress update on Linux port

As you probably know, or at least heard, we are currently porting Workbench to Linux. Generally speaking the porting process is split in several stages. The first one is to compile non-GUI Back-End which represents about 80% of the total application code. The next stage is to ensure that unit-tests are run correctly for the ported stuff. The third is to create user interface and to bind it to the back-end/core. After that we will have alpha version of Workbench for Linux.
Regarding tests, actually a portion of unit-tests are already passed. These are 121 of 122 going well. At the moment we are working on non-GUI back-end, and core part is compiled and run, so now the modules and plugins are in progress. I must admit that process of porting is pretty smooth, most of the code has already been prepared with Linux/OS X ports in mind. I will be posting our progress on the porting efforts frequently, please keep checking our blog.