Installing mysql from source on non-x86 machines
This is a placeholder to help me remember how I managed to get mysql compiled, liked, installed (the easy part) and running on various architectures besides x86. For the moment, that means ARM (armv6 and armv7) on i.MX31 PDK and Beagle board (OMAP3530.)
It's been a fun but sometimes frustrating effort!
I didn't even try to "cross" compile this package. It's a large project and uses lots of scripts and host-compiled helper programs. It has more than 6,400 files and 3.5 million lines of 'text', much of it application and test code.
[Update: after I got it running, I went back to tackle cross compiling. Notes are below.)
To compile mysql on ARM, I used a native toolchain from MontaVista and found out the hard way that I had to use --with-low-memory on the ./configure command line.
# ./configure --with-low-memory
I accepted the defaults (install to /usr/local, etc) for the rest.
Once make && make install were complete, the fun began.
I borrowed a pre-packaged minimal my.cnf config file from a Trixbox installation. It's attached to this topic. (You have to be a registered user to see it.) Download and rename it to /etc/my.cnf.
Once you've gotten this far, these steps give an approximate idea of what you must do next:
Post Installation Steps
The most important of these steps is to install the initial tables that mysql needs.
# ./mysql_install_db --user=mysql
To resolve the socket error when using mysqladmin to do the initial setup, which looks like this:
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock
I took the cheap and dirty route and put a soft link in /tmp point to our configured value from my.cnf:
# ln -s /var/lib/mysql/mysql.sock /tmp
I'm sure there's a configuration option for it (likely a compile-time configuration) but I didn't have time to find it. It's curious that mysqladmin doesn't read my.cnf even when manually told to via command line. Hmmm..oh well, there's probably a good reason. ;)
These steps produce a minimally configured, and very _unsecure_ installation. For anything even remotely production-ready, you'll need to at least begin by securing your installation. Here's the official link to that topic:
I started with mysql-5.0.67.tar.gz.
I had to make some modifications to configure.in, to get this package to cross compile. A patch is attached to this topic for that. Please note that it's not a fix, but a pretty ugly hack, because what I know about autoconf wouldn't fill a paragraph. Again, you have to be an authenticated user to view the attachments to this topic.
I'd love to hear from someone who actually knows how to do this the "right" way! ;)
After applying the patch for configure.in, run autoconf, followed by automake, and then the usual ./configure; make; make install.
The ./configure command I used is also attached to this topic as mysql-configure.txt. Again, you have to be logged in to view attachments.
Once the build was complete, I used DESTDIR to install to an isolated directory on my system and tar'd it up and moved it to the board and untar'd it.
|Configure command for i.mx31/MontaVista armv6 toolchain||341 bytes|
|Patch for ./configure.in for cross-compiling (more of a hack than a patch)||6.15 KB|
|Simple my.cnf from Trixbox||317 bytes|