So far in the tutorial we've been building migrations for SQLite.
This is a good database for initial prototyping and local development,
but at some point you'll need a more production oriented database.
By the end of this tutorial you should have the basics of adding support for MySQL to your migrations.
We'll add MySQL migrations for version 3.

You'll also notice that we can't build version 2 to 3 upgrades for MySQL, since we don't have a version 2 of the database for MySQL. We'll skip working on upgrade files for MySQL since they won't essentially be at all different from the work you've don't already of SQLite. If you needed to rebuild all the versions, you actually can install down to Version 1 and build each step for MySQL (an exercise I'll leave to your practice session!)

So far you've only done install and upgrade to the default SQlite database (under share). If you want to run those commands against MySQL, obviously you'll need a running MySQL instance. We can build a MySQL sandbox for you in the target_dir, similarly to how we did for Sqlite. To do this you need to set the sandbox_class flag. Also, you should add Test::mysqld to your dist.ini file, and get that installed (you'll need to install MySQL on your development computer, but it doesn't need to be running, just 'findable' in your $PATH:

If you have any trouble, you'll need to resolve that before moving on with the tutorial. In my experience, DBD::mysql installs easily if you make sure $PATH can find the Mysql bin area (mysql_config, etc).

Assuming you get MySQL properly installed, lets build a sandbox:

$dbic-migration -Ilib --sb MySQLSandbox status
Schema is 3
Database is not currently installed

Just like with the schema_class flag, you can set an %ENV variable to set your sandbox type for the shell:

## example
export DBIC_MIGRATION_SANDBOX_CLASS=MySQLSandbox

We won't do this, since we'd like to continue controlling if we are using the default sqlite sandbox or our new mysql sandbox.

Once you run that command you'll see a new directory in your target_dir, which in this tutorial is under share:

/share
/fixtures
/migrations
/musicbase-schema
musicbase-schema.db

that new share/musicbase-schema directory contains the actual mysql sandbox files. You should probably set your repository to ignore this directory, since it is unlikely you want those shared with other developers.

BTW, if you peek inside share/musicbase-schema/bin you'll spot a couple of helper scripts:

/bin
start
stop
use

start and stop starts and stops the sandbox (by default we stop the sandbox when your migration command exits). You'll use this if you want to use the sandbox (opens a mysql shell) or if you want to let you application use the sandbox (for example later on if you are using Catalyst you'd want to start the sandbox so that you can expose to to your web application).