Use MySQL 5.1 with Engine Yard Cloud

Updated: August 2nd, 2013

The MySQL 5.1 database is a candidate for testing on Engine Yard Cloud. Read this page if you want to participate in the MySQL 5.1 Early Access program.

Important! MySQL 5.1 on Engine Yard Cloud is an Early Access feature. Always test first in a development or staging environment.

Enable the MySQL 5.1 feature

You need to enable the Early Access feature before you can participate in the program.

To enable the MySQL 5.1 Early Access

  1. Log in to your Engine Yard Cloud account.

  2. On the dashboard, click Tools > Early Access on the toolbar.

    Tools_EarlyAccess__1_.png

  3. Next to the MySQL 5.1 feature, click Enable.

    The related functionality becomes available.

Get started with MySQL 5.1

The process for setting up and running your application on MySQL 5.1 depends on your current environment.

  • Is this a new application? Then do this:

    • Set up an application to use MySQL 5.1
  • Are you running Engine Yard Cloud with MySQL 5.0.x now? Then, do these tasks:

    • Set up an application to use MySQL 5.1
    • Dump and restore an existing MySQL 5.0.x database
  • Are you migrating a MySQL-based application to Engine Yard Cloud from another platform? Then, do these tasks:

    • Set up an application to use MySQL 5.1
    • Dump and restore an existing MySQL database
  • Are you using a database other than MySQL? Then:

    Please consult Engine Yard Professional Services for assistance migrating your database to MySQL 5.1.

Set up an application to use MySQL 5.1

Follow this procedure to set up a new environment that uses a MySQL 5.1 database. You can create a new application and a new environment or create a new environment for an existing application.

If you are migrating an existing MySQL database, you’ll need to perform a dump and restore aftercreating a new environment (Dump and restore an existing MySQL database).

To use MySQL 5.1 with Engine Yard Cloud

  1. Important: If you have applied any custom Chef recipes for MySQL, disable them in your ey-cloud-recipes repository. You may re-apply them to your new database instance after completing the tasks on this page.
    For general information about custom Chef recipes, see Custom Chef recipes.

  2. Create a new application with a new environment or add an environment to an existing application, making sure to:

    • Set the Database Stack to MySQL 5.1.x. If this option is not available, see Troubleshooting.

    • Add the mysql2 gem to your Gemfile for Rails 3 (or via the dashboard for Rails 2).

      source "http://rubygems.org" 
      gem "mysql2"
    • Select SSH Keys.
      This allows you to SSH into the new instance and to copy the database dumpfile to the instance, described in the procedure below.

  3. Deploy the application.

Dump and restore an existing MySQL database

If you are currently running a MySQL database (5.0.x), you need to dump the database, create a new MySQL environment, move the database dump file to the database instance, and finally load the file into the MySQL database.

You can perform these tasks yourself (as outlined below) or ask Engine Yard Professional Services to do the migration for you.

To dump and restore the MySQL database

See the MySQL documentation for full details on dumping and restoring a database.

Note: The following commands assume you are logged into the db_master instance.

  1. Dump the database.

    mysqldump -u #{user} -p -h #{hostname} #{dbname} | gzip > dumpfile.sql.gz 

    Notedbname is the name of the database used by your application. hostname is the name of the server or instance hosting your MySQL 5.0.x database. For more information, see Find your generated MySQL password and connect to your DB.

    For example,

    mysqldump -u deploy -p -h ec2-172-72-33-150.us-west-1.compute.amazonaws.com mydatabase | gzip > dumpfile.sql.gz 
  2. Move the output file to the new environment.

    scp dumpfile.sql.gz username@newserver:/#{path_to_file}/ 

    For example,

    scp dumpfile.sql deploy@ec2-174-129-17-196.compute-1.amazonaws.com:/tmp/mysql 

    Note: The new server is the database instance assigned for your MySQL 5.1 environment that you created above.

  3. SSH to the new database instance.

  4. Import the output file to the new MySQL 5.1 database.

    gunzip < dumpfile.sql | mysql -u #{user} -p -h #{hostname} #{dbname} 
  5. Test the application running in the new environment.

  6. After verifying that your application is running correctly in the new environment, delete the old environment (running MySQL 5.0.x).

Connect to your MySQL 5.1 database

To connect to your MySQL 5.1 database

  • See Connect to your instance via SSH and Find key information about your database.

More information

For more information about... See...
Database tasks                                                                                                                 Managing your database (Many of the tasks apply to MySQL 5.1 as well as to MySQL 5.0.)                    
MySQL MySQL documentation
SSHing to your database Connect to your instance via SSH
SSH public keys Using SSH on Engine Yard Cloud
Deleting an environment Delete an environment documentation

Troubleshooting

This table contains troubleshooting tips related to MySQL and the Early Access program.

Symptom Solution
I don't have the Database Stack option for MySQL 5.1 on my new environment page. You need to enable the MySQL 5.1 feature. See Enable the MySQL 5.1 feature.

Comments

0 comments

Article is closed for comments.