0

I'm using Rails 3, and Ubuntu. I want to change the default Rails SQLite3 into a mysql database. I ran these commands:

sudo apt-get install mysql-server mysql-client libmysqlclient15-dev
sudo apt-get install libmysql-ruby1.8

These were successful. Then I did this in the gemfile

#gem 'sqlite3'
gem 'mysql'

This worked, now, what else should I do to complete the MySQL setup. I know for one the database.yml needs to change, but how does it need to look for Ubuntu and how do I fill in the parameters?

2 Answers 2

2

Your config/database.yml must look like :

base: &base
  adapter: mysql
  username: YourUserName
  password: YourPassword
  host: localhost
  encoding: utf8
  pool: 5
  timeout: 5000
development:
  database: YourApp_dev
  <<: *base
test:
  database: YourApp_test
  <<: *base
production:
  database: YourApp_prod
  <<: *base
Sign up to request clarification or add additional context in comments.

8 Comments

is user, my username for my ubuntu machine when im logging on? Is password my password that i chose when i installed the mysql server?
The username and the password must be the ones you use to log to your mysql server
No, they are your mysql user credentials. not OS specific
there are options to set them and have them match your login, please see the mysql site to read up on the info for this
I was never prompted to make a username, but i was for a password when installing the server. How do i retrieve the user
|
0

Is the database on the same host?

You need to log into mysql, set a user, create a database. If the database is on a database server, outside of the application server, then you will need to make accessible from the net.

http://www.slac.stanford.edu/BFROOT/www/Computing/Online/Databases/CfgDB/CfgDB-MySQL-Setup.html

After you're done setting up the database (not just installing it), then you're database.yml files need to be modified per the above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.