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
- Part 1 // Apache
- You are here!
- Part 3 // Git
- Part 4 // Ruby, Gems & Rails
- Part 5 // Passenger
- Part 6 // Gitosis
- Part 7 // Capistrano
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 [shell] yum install httpd-devel\
Once you are done, you can boot up mysql by doing this [shell] service mysqld start[/shell]
And also make sure that mySQL starts when you boot up your server. [shell]chkconfig mysqld on[/shell]
Now, let’s make sure that we have a database prepped for a test rails application. To do that, run [shell]/usr/bin/mysql -u root -p[/shell] Enter your root password if there is any.
You should be greeted with a friendly :[shell] mysql> [/shell]
If you want to change your root password you can do so by running this, [shell]UPDATE mysql.user SET Password = PASSWORD(‘password’) WHERE User = ‘root’;
Let’s create a database for our rails test application. 😀 [shell]CREATE DATABASE demodb;[/shell]
And add a user for this database. [shell] INSERT INTO mysql.user (User,Host,Password) VALUES(‘loginname’,’localhost’,PASSWORD(‘yourpassword’));
GRANT ALL PRIVILEGES ON demodb.* to loginname@localhost;
Now you have a working database! Yay!
For a list of handy commands to communicate with your mySQL database, head here.
Next : Git
Wow. So interes.. *snore*
ish. you are so nais.
yo nice stuff.. i was wondering how to get to this crapistrano stuff