Zeltus MySQL aide-memoire - Installation Notes
Last Amended: 14th November 2009
I struggled somewhat with getting MySQL up and running on my FreeBSD jail (Virtual Server). Having finally succeeded, it all promptly crashed on me! Re-compiling with a couple of options (as detected using "make pre-fetch") seemed to finally get me a stable set-up. As I couldn't find a single complete source for help on the 'net (altho' I did find lots of tips and pointers from other people, like me, who had struggled - thanks to all of you for bothering to report your progress), just for once I have decided to put my session journal here. Not just in the hope that someone else might find it useful but also to remind me of what I did and why, for when I next have to re-install it!
Prior to this session, I had set up user "mysql" and ensured the mysql port was ready to be installed. Thanks to (failed) previous attempts, /etc/rc.conf was already set up for automatic starting of mysql upon reboot. But I've grepped in this session to at least show what files and user settings were involved.
By the end of this session, I was able to install and run phpMyAdmin, which is all I need to manage MySQL at this stage.
phpMyAdmin was very easy to install and get running - after struggling with MySQL, this was a very pleasant surprise. As an ex-Oracle DBA (almost), I'm more than happy to work at the command line if I have to. But if there is a GUI front-end about, then I'm not that much of a dinosaur that I'll refuse to use it.
#
# Example session demonstrating installation of MySQL 5.1 on FreeBSD 6.2...
#
# 2 June 2008
#
$ su - root
zeltus> grep mysql /etc/passwd
mysql:*:88:88:MySQL Daemon:/nonexistent:/sbin/nologin
zeltus> grep mysql /etc/group
mysql:*:88:
zeltus> cd /usr/ports/databases/mysql51-server
zeltus> make -DWITH_PROC_SCOPE_PTH=yes -DBUILD_OPTIMIZED=yes
zeltus> make install clean
zeltus> mysql_install_db
zeltus> chown -R mysql:mysql /var/db/mysql/
zeltus> grep mysql /etc/rc.conf
mysql_enable="YES"
# mysql_limits (bool): Set to "NO" by default.
# mysql_dbdir (str): Default to "/var/db/mysql"
# mysql_args (str): Custom additional arguments to be passed to mysqld_safe (default empty).
zeltus> cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
zeltus> /usr/local/bin/mysqld_safe --user=mysql &
zeltus> mysqladmin -u root password 'TopSecret'
zeltus> mysql -u root -p
mysql> UPDATE mysql.user SET Password=PASSWORD('TopSecret') WHERE User='root';
mysql> FLUSH PRIVILEGES;
#
# and for when I need it, to shut everything down...
#
zeltus> mysqladmin -u root -p shutdown
