Deploying Rails to Centos 5 : mySQL
ShareThis

Deploying Rails to Centos 5 : mySQL

387 days ago in Coding / Learn

Hello, this is part two of the series!

If you have played with Rails before, you would know that the default database is SQLite. That is fine for development, for production having mySQL is better for handling more queries.

Deploying Rails to Centos 5

Make sure you have Apache installed before doing this. There are a few dependencies that you should install as well. Connect via ssh to your remote server and run this command

 yum install httpd-devel
openssl-devel
zlib-devel
gcc
gcc-c++
curl-devel
expat-devel
gettext-devel
mysql-server
mysql-devel

Once you are done, you can boot up mysql by doing this

 service mysqld start

And also make sure that mySQL starts when you boot up your server.

chkconfig mysqld on

Now, let’s make sure that we have a database prepped for a test rails application. To do that, run

/usr/bin/mysql -u root -p

Enter your root password if there is any.

You should be greeted with a friendly :

 mysql> 

If you want to change your root password you can do so by running this,

UPDATE mysql.user SET Password = PASSWORD('password') WHERE User = 'root';
FLUSH PRIVILEGES;

Let’s create a database for our rails test application. icon biggrin : Deploying Rails to Centos 5 : mySQL

CREATE DATABASE demodb;

And add a user for this database.

 INSERT INTO mysql.user (User,Host,Password) VALUES('loginname','localhost',PASSWORD('yourpassword'));
GRANT ALL PRIVILEGES ON demodb.* to loginname@localhost;
FLUSH PRIVILEGES;

Now you have a working database! Yay!

For a list of handy commands to communicate with your mySQL database, head here.

Next : Git

Discuss : Deploying Rails to Centos 5 : mySQL

  1. erin says:

    Wow. So interes.. *snore*

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>