Categories
computer

OpenStack Diablo on Ubuntu 11.10 w/MySQL

If you’re installing the OpenStack cloud computing platform “Diablo” release on Ubuntu 11.10 server using the official guide and are using MySQL, don’t forget to:

sudo apt-get install python-mysqldb

The “glance” package (and probably others) are configured to use SQLite by default and do not automatically install this dependency by default. Unfortunately, the November 2011 version of the manual also fails to mention this and the log file (/var/log/glance/registry.log) prints a variety of “INFO [sqlalchemy.engine.base.Engine…” messages but no warnings or errors. I assume a corresponding comment applies to PostgreSQL as well but have not confirmed.

Categories
computer

MacPort MySQL “Can’t find file: ‘./mysql/host.frm'” Error

I recently set up a new Mac OS X Snow Leopard laptop for software development purposes. After going through my usual MacPorts installation and installed MySQL using the following steps

  1. sudo install mysql5-server
  2. sudo cp /opt/local/var/macports/software/mysql5/5.1.44_0/opt/local/share/mysql5/mysql/my-medium.cnf /opt/local/etc/mysql5/my.cnf
  3. sudo -u mysql mysql_install_db5
  4. sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

A few days past, and one day I notice that launchctl was loading the script, but `nmap localhost` did not show the the process listening on port 3306 as expected. I looked at the log file:

sudo tail -f /opt/local/var/db/mysql5/preston.local.err

..and noticed it was terminating with the following errors:

100331 12:05:30 [ERROR] /opt/local/libexec/mysqld: Can’t find file: ‘./mysql/host.frm’ (errno: 13)
100331 12:05:30 [ERROR] Fatal error: Can’t open and lock privilege tables: Can’t find file: ‘./mysql/host.frm’ (errno: 13)

100331 12:05:30 [ERROR] /opt/local/libexec/mysqld: Can’t find file: ‘./mysql/host.frm’ (errno: 13)100331 12:05:30 [ERROR] Fatal error: Can’t open and lock privilege tables: Can’t find file: ‘./mysql/host.frm’ (errno: 13)

After a considerable amount of grief I evertually discovered that the contents of /opt/local/var/db/mysql5/ need to be owned by the appropriate mysql user (in my case “_mysql”), but some files were being owned by the “root” user. After correcting all file ownership and restarting the service…

  1. sudo chown -R _mysql /opt/local/var/db/mysql5/
  2. sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
  3. sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Everything now seems to work fine again. Hope this helps!

Categories
computer

Installing The MySQL Ruby Gem When Using The Official MySQL .dmg

If you installed MySQL using the official .dmg package provided by MySQL AB/Sun and are trying to install the native MySQL gem, you’ll need to pass a bunch of flags to the gem install process to get the thing to compile. Try this..

sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config

..if you still have issues (check your /opt/local/lib/ruby/gems/<ruby_ver>/gems/mysql-<gem_ver>/mkmf.log file), try this instead..

sudo gem install mysql — –with-mysql-dir=/usr/local/mysql –with-mysql-include=/usr/local/mysql/include/ –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql-config=/usr/local/mysql/bin/mysql_config

Run `sudo gem install mysql` and definitely recheck the log file again as the gem install process sometimes reports false positives even if native components fail to install.