Hints, Tips and InstallationBack to Tutorials Sapphire (Ruby In Steel) Tutorials Archives Hints, Tips and Installation
Installing MySQL For Ruby On Rails
If you are working with Rails, you will need to install a database. While there are quite a few possible choices available to you, one of the most widely used is MySQL. You can download and install MySQL for free. However, if you’ve never used MySQL before, you may find some of the setup options confusing. In this tutorial, we’ll try to guide you through the process to avoid potential problems...
The MySQL main site is at http://www.mysql.com/ and from here you can navigate to the download page for the current version.
I shall assume that you will be using the free edition of MySQL. This is available for download on the http://dev.mysql.com/downloads/ page. The current version, at the time of writing, is MySQL 5 Community Server. The name and version number will, of course, change over time. Download whichever is the current (not upcoming, alpha or beta) release. Choose the specific version recommended for your operating system (there may be different versions for Win32 and Win64, for example).
You will need to scroll some way down this page to locate the Windows installers. You can either download the complete MySQL package or the smaller Windows Essentials package. The complete package contains extra tools for database developers but these are not required for simple Rails development. For most people, therefore, the smaller Windows Essentials download file is the one to get.
You should click the ‘Pick A Mirror’ link alongside this option. You will then be shown a questionnaire which you can fill out if you wish. If you don’t wish to do so, just scroll down the page and pick a regional download site. Click a link and save the file, which will be named something like (the numbers may differ): mysql-essential-5.0.41-win32.msi, to any convenient directory on your disk.
Once the download has completed run the program by selecting Open or Run in the download dialog if this is still visible, or by double-clicking the installation file via Windows Explorer.
|Note: During the installation of MySQL some advertising screens may appear. Click the buttons to move through these. Some security warnings may also prompt you to verify your intention to install the software. When prompted, you should click the necessary options to continue with the installation.|
The first page of the Setup Wizard will now appear. Click the Next button.
You can either leave the Typical setup option selected if you are happy to install the software into the default MySQL directory beneath C:\Program Files\. If you want to install to some other directory, however, select Custom. Then click Next. Click Change to change the directory.
When you are ready to move on, click Next. You will see the screen stating ‘Ready To Install the Program’, verify that the destination folder is correct, then click the Install button.
Depending on the version of MySQL you may now either be shown some promotional screens or you may be prompted to create a new MySQL account which will let you receive news of changes and updates. These are not an essential part of the software installation and you may click the Next or Skip buttons to move on through the installation.
The Wizard Completed dialog now appears. Click the Finish button.
In fact, this isn’t the end of the installation after all. With some installers, a new screen pops up now welcoming you to the MySQL Server Instance Configuration Wizard. If this does not occur, you will need to load this yourself. Click the Start menu, then Program->MySQL->MySQL Server 5.0 (or whichever version number you are using) then MySQL Server Instance Config Wizard.
Click Next. Assuming that this is the first time you’ve installed MySQL on this machine, you can select Standard Configuration (if you are upgrading from an older version of MySQL you need to select Detailed Configuration – that is beyond the scope of our simple setup guide). Click Next.
In the next dialog, leave the default options selected (i.e. Install As Windows Service; Service Name = ‘MySQL’ and Launch the MySQL Server automatically). Then click Next.
In the next screen, leave ‘Modify Security Settings’ checked and enter the same password (of your choice) into the first two text fields. You will need this password later so remember it or write it down in a secure location. If you may need to access MySQL from another computer you can check ‘Enable root access from remote machines’. Then click Next.
|Note: The default MySQL user name is ‘root’. The password is the one you just entered. You will need both these items of information later when creating Rails applications.|
The next screen just gives you some information about the tasks that are about to be performed. Click the Execute button.
|If you have previously installed or configured MySQL, you may see an error message which tells you to Skip the installation. You may click Retry to see if you can bypass this problem. If not, press Skip and then restart the MySQL configuration process, selecting Reconfigure Instance and Standard Instance when prompted.|
When everything is installed this screen appears. Click Finish.
And that’s it!
Just to test that everything’s working, you can open the MySQL command line client. You can do this from the MySQL group on the Windows start menu. A ‘DOS box’ will appear and you will be prompted to enter your password. Once you’ve entered this, you will be welcomed to the MySQL monitor with a mysql> prompt. Enter \h for some help. Enter quit to exit.
Configure MySQL In Ruby In Steel
Finally, you should check the paths to MySQL in Ruby In Steel. Load Visual Studio (this assumes you have Ruby In Steel Developer installed - for help on configuring other versions please refer to the appropriate Ruby In Steel manual).
Select Tools->Options->Projects and Solutions->Ruby In Steel. Verify that the MySQL Server path is set to the \bin directory into which MySQL Server was installed (e.g. C:\Program Files\MySQL Server 5.0\bin). You may browse to locate the install directory if necessary. Then click OK.
You should now be all set up to use MySQL with Ruby In Steel.