Hacking the latest storage engine? Working on a fancy new SHOW command? Hunting for a bug in mysqld? This is for you!
Once you’ve got MySQL compiled, how do you test your mysqld binary? You’ll need to get it started. Stop! Don’t make install it!
- Set up your sandbox
$ mkdir ~/t $ vi ~/t/my.cnf
Add the following to ~/t/my.cnf (modify to taste):
[mysqld] basedir=. datadir=/Users/jcole/t port=3307 socket=/Users/jcole/t/mysql.sock skip-grant skip-innodb skip-bdb [client] port=3307 socket=/Users/jcole/t/mysql.sock
- Build your source
- Set up a symlink for share/mysql pointing to the share directory.
$ mkdir share && ln -s ../sql/share share/mysql
This, combined with the basedir=. in my.cnf means that MySQL will be able to find its error message and character set files, so that the release you’re building doesn’t have to match the release installed on the system.
- Start mysqld
$ sql/mysqld --defaults-file=~/t/my.cnf
- Start a mysql client (in another window)
$ client/mysql --defaults-file=~/t/my.cnf
- Shutdown the mysqld (if it didn’t crash :) )
$ client/mysqladmin --defaults-file=~/t/my.cnf shutdown
That’s it! Much easier, safer, and faster than using make install, and you don’t need to remember all the options to specify to start and test your newly built mysqld! If you manage to break your sandbox, just delete everything except my.cnf and you are back to a clean slate.