Getting Rails Back


This was written last week, but I haven’t posted it.

So I decided to reinstall the OS and use Locomotive to install all the Ruby on Rails stuff I was missing. It isn’t quite that easy.

First you need to reinstall MySQL. And you probably want to install the pref panel. It lets you turn the mysql server on.

Then run Locomotive.

Now for some reason webrick won’t work in the project I already had been working on. But I was able to launch it via Locomotive, but I immediately get and error saying “Access denied for user ‘root’@’localhost’ (using password: YES)”

While looking for that problem I realized I didn’t have any databases set up. Using CocoaMySQL I’m able to log in with root @localhost and no password and create databases. Had to go back and look for the names of the database, in this case repsystem_development.

Still can’t get it to work because of the access denied error. So I decided I better blog this incase I ever have to do this again.

OK found the fix. You have to make sure the password in your database.yml file is the same as in the mysql database. In my case they weren’t because I’d set root’s password in the database.yml file. But when you install mysql the root@localhost password is empty. You use these commands to set it:

shell> mysql -u root
mysql> SET PASSWORD FOR ”@’localhost’ = PASSWORD(‘newpwd’);
mysql> SET PASSWORD FOR ”@’host_name’ = PASSWORD(‘newpwd’);

Now my app runs under Locomotive like it should.

Technorati Tags: ,