<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mundo Ruby &#187; msyql</title>
	<atom:link href="http://www.mundoruby.com.ar/tag/msyql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mundoruby.com.ar</link>
	<description>Ruby Artists, Hackers y otras yerbas ...</description>
	<lastBuildDate>Wed, 12 Aug 2009 23:02:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RubyInstaller: Getting Started with Rails and MySQL</title>
		<link>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:09:53 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[msyql]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=125</guid>
		<description><![CDATA[
This is a follow up instruction set from previous post, but this time, using MySQL

Getting Ruby
These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer from here
For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>This is a follow up instruction set from <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/">previous post</a>, but this time, using MySQL</p>
<p><span id="more-250"></span></p>
<h3>Getting Ruby</h3>
<p>These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer <a href="http://rubyinstaller.org/downloads">from here</a></p>
<p>For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing with <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/prompt.png" alt="Command Prompt with Ruby 1.9" title="Command Prompt with Ruby 1.9" width="515" height="365" class="alignnone size-full wp-image-238" /></p>
<h3>Getting the right MySQL version</h3>
<p>While building the MySQL/Ruby bindings, we found that mixing versions of the bindings with different versions of MySQL installations ended on undesired results (abnormal program termination, weird errors, etc.)</p>
<p>For this guide, and because we are going to use binary gems, we are going to stick to MySQL version <strong>5.0.83</strong>. </p>
<p>Now is time to download MySQL. For this guide, I&#8217;m going to install the <em>essentials</em> version, which contains only MySQL and command line tools, no Query Builder or any other administrative tool.</p>
<p>Please go to <a href="http://dev.mysql.com/downloads/mysql/5.0.html#win32">this page</a> and download <em>Windows Essentials (x86)</em>. Once downloaded you will end with <code>mysql-essential-5.0.83-win32.msi</code> file. Execute it and install with defaults.</p>
<h3>Configure MySQL</h3>
<p>If you&#8217;re an advanced and savvy MySQL user, you can skip the following steps. For the sake of this guide, I&#8217;m going to list the simple options you must follow when installing it.</p>
<p>Once you installed MySQL, the installer should have started the <em>Configuration Wizard</em> page.</p>
<p>Inside of it, please apply the following options:</p>
<table>
<tr>
<th>Option/Screen</th>
<th>Value</th>
</tr>
<tr>
<td>Configuration Type</td>
<td>Detailed configuration</td>
</tr>
<tr>
<td>Server type</td>
<td>Developer Machine</td>
</tr>
<tr>
<td>Database usage</td>
<td>Transactional Database only</td>
</tr>
<tr>
<td>InnoDB datafile</td>
<td><em>Your option or leave defaults</em></td>
</tr>
<tr>
<td>Number of connections</td>
<td>Decision Support</td>
</tr>
<tr>
<td>Networking options</td>
<td>Check <em>Add firewall exceptions</em></td>
</tr>
<tr>
<td>Character set</td>
<td>Best support for Multilingualism (UTF8)</td>
</tr>
<tr>
<td>Windows Options</td>
<td>Add to <span class="caps">PATH </span>if you want <em>mysql</em> available on every prompt</td>
</tr>
<tr>
<td>Security Options</td>
<td>Uncheck if you want <em>root</em> password be blank</td>
</tr>
</table>
<p>Once done with all this, on the summary screen, please click <em>Execute</em> to complete the configuration of MySQL Server.</p>
<p>Under some system, starting of MySQL server will fail during this wizard, but don&#8217;t be afraid, most of the times, this can be safely ignored.</p>
<p>To check everything was properly installed, please go to the Start Menu, and inside <em>MySQL Server 5.0</em>, click on <em>MySQL Command Line Client</em></p>
<p>If you changed the <em>root</em> password, or, like me, leaved it unchecked, you can simply press enter when asked for the password and see that the server is running!</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/mysql-client.png" alt="MySQL Console Client" title="MySQL Console Client" width="566" height="353" class="alignnone size-full wp-image-253" /></p>
<p>If you decided to add MySQL to the <span class="caps">PATH, </span>you will require to restart your computer so the <span class="caps">PATH </span>change is available to the system.</p>
<p>If you decided not to add MySQL to the <span class="caps">PATH, </span>please go, with Explorer to the location where you installed MySQL Server and copy <code>libmySQL.dll</code> into <code>C:\Ruby19\bin</code></p>
<p>In my case, I found this file in <code>C:\Program Files\MySQL\MySQL Server 5.0\bin</code></p>
<p>Now, it is time to install the bindings.</p>
<h3>Getting MySQL/Ruby</h3>
<p>For this version of Ruby, there is no official binary gems for both Ruby 1.8 and 1.9. So we are going to install the specially built version from RubyInstaller gems repository. </p>
<p>At the <em>Command Prompt with Ruby</em>, please enter the following command:</p>
<pre>
gem install mysql --source http://gems.rubyinstaller.org
  </pre>
<p>This is going to install the special version of MySQL bindings. This version works with Ruby 1.8 and 1.9, since bundles <em>fat binaries</em>. You should expect a similar output like this:</p>
<pre>Successfully installed mysql-2.8.1.1-x86-mingw32
1 gem installed</pre>
<h3>Getting Rails</h3>
<p>Now is time to install Rails and build our application. At the same command prompt, please enter the following command:</p>
<pre>gem install rails</pre>
<p>This is going to take a bit, since Rails and it&#8217;s dependencies takes around 2MB or so, and need to be downloaded and installed.</p>
<p>Once done, expect see at the screen something like this:</p>
<pre>Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<h3>Creating a Rails application</h3>
<p>Let&#8217;s name our application <code>mysqlapp</code></p>
<pre>rails mysqlapp --database=mysql</pre>
<p>The <code>--database</code> option indicates to Rails that we want to use MySQL instead of the default database adapter (SQLite3).</p>
<p>Rails will output a lot of lines when creating your application structure, just an excerpt of what to see:</p>
<pre>
...
      create  config/database.yml
      create  config/routes.rb
      create  config/locales/en.yml
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/initializers/session_store.rb
      create  config/environment.rb
...
</pre>
<h3>Configuring our Database</h3>
<p>Now Rails have configured for us the name of the database we want to use, and you can verify it in <code>config\database.yml</code></p>
<p>Rails will try to connect to <code>mysqlapp_development</code>, but that database do not exist in our fresh new MySQL server.</p>
<p>So, let&#8217;s create it:</p>
<pre>cd mysqlapp
rake db:create</pre>
<p>Just that, simple <code>db:create</code> is going to connect to our MySQL server, and create the database for us.</p>
<p>Keep in mind that if you changed root password or want to use other MySQL user to connect to the database, you need to edit <code>database.yml</code> to reflect those changes.</p>
<p>Let&#8217;s verify that everything is in place, using the following command:</p>
<pre>About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.4
Rack version              1.0 bundled
Rails version             2.3.2
Active Record version     2.3.2
Action Pack version       2.3.2
Active Resource version   2.3.2
Action Mailer version     2.3.2
Active Support version    2.3.2
Application root          C:/Users/Luis/mysqlapp
Environment               development
Database adapter          mysql
Database schema version   0</pre>
<p>Now is up to you to create your models, controllers and views!</p>
<h3>Some notes and considerations</h3>
<p>On other post I&#8217;m going to guide you with steps on building the bindings against MySQL 5.1.36, since you will need to install the Ruby Development Kit and the development headers for MySQL.</p>
<p>If you find something wrong with the Ruby Installer, please report it <a href="http://rubyforge.org/tracker/?atid=715&amp;group_id=167&amp;func=browse">here</a>, but issues with your code, Rails or other are not responsability of RubyInstaller.</p>
<p>The binary gems provided at <code>gems.rubyinstaller.org</code> are based on our forks of mysql bindings, which can be cloned and explored <a href="http://github.com/luislavena/mysql-gem">here</a> at GitHub.</p>
<p>Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.</p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/#comments">RubyInstaller: Getting Started with Rails and MySQL</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

