# Rails and mysql

**URL:** <https://www.ruby-forum.com/t/rails-and-mysql/141004>\
**Category:** Rails\
**Created:** [June 20, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004 "2008-06-20T18:14:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 20, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/1 "2008-06-20T18:14:18Z")

</div>

Hello:

I have been used to mysql.But how to install it with rails 2.1? I can  
find many instructions for sqlite with rais2.1 except mysql.

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 20, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/2 "2008-06-20T18:21:28Z")

</div>

To create a rails app that uses mysql instead of the default of sqlite  
you can run the command “rails myappsname -d mysql”

(this assumes you have mysql installed)

Best.  
Mike

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 20, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/3 "2008-06-20T19:25:43Z")

</div>

Michael B. wrote:

> To create a rails app that uses mysql instead of the default of sqlite  
> you can run the command “rails myappsname -d mysql”
> 
> (this assumes you have mysql installed)
> 
> Best.  
> Mike

thank you!But i do not know how to install the mysql.just download it  
and install it or need some gem?

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 20, 2008, 7:32pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/4 "2008-06-20T19:32:10Z")

</div>

mysql should be downloaded and installed  
There is a mysql driver that should be installed as well.

On Jun 20, 10:25 am, Guo Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 20, 2008, 7:43pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/5 "2008-06-20T19:43:20Z")

</div>

Driver?

Install MySQL separate using either the installer for Windows or rpm/  
source if you are on a unix system. Make sure mysql is working and is  
listening to a port that you can connect to. (like 3306)

Either create a new rails project with -d mysql or edit your confg/  
database.yml to look like this:

development:  
adapter: mysql  
encoding: utf8  
database: database\_devel  
username: root  
password:  
port: 3306

By default there is a ruby driver that is installed WITH rails so  
there is no need to install anything to get MySQL working with rails.  
There is a NATIVE gem that you can install to get better performance  
for MySQL and this is recommended for production … Something like  
this:

gem install mysql – --with-mysql-config (if mysql is in your path)

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 21, 2008, 6:56pm UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/6 "2008-06-21T18:56:02Z")

</div>

Have you been able to resolve the problem?

On Jun 20, 6:04 pm, Guo Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 21, 2008, 3:04am UTC](https://www.ruby-forum.com/t/rails-and-mysql/141004/7 "2008-06-21T03:04:10Z")

</div>

heimdull wrote:

> Driver?
> 
> Install MySQL separate using either the installer for Windows or rpm/  
> source if you are on a unix system. Make sure mysql is working and is  
> listening to a port that you can connect to. (like 3306)
> 
> Either create a new rails project with -d mysql or edit your confg/  
> database.yml to look like this:
> 
> development:  
> adapter: mysql  
> encoding: utf8  
> database: database\_devel  
> username: root  
> password:  
> port: 3306
> 
> By default there is a ruby driver that is installed WITH rails so  
> there is no need to install anything to get MySQL working with rails.  
> There is a NATIVE gem that you can install to get better performance  
> for MySQL and this is recommended for production … Something like  
> this:
> 
> gem install mysql – --with-mysql-config (if mysql is in your path)

Thank you!I should be able to resolve it.
