Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is my first question on serverfault, although I have used stackoverflow before.

I am in a Ruby on Rails class over this summer and need to get RoR running ASAP. I used MacPorts to install Ruby, Rubygems, Rails, and mysql (I installed two ports named "rb-mysql" and "mysql5"). I was following a tutorial which requires that we use mysql to modify a basic RoR database, and got this:

Icarus:people atg$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)

There is no socket at the location specified. I can't find a socket anywhere. I've never been able to start anything up with mysql, so I'm not sure what I'm doing wrong here. As I'm new to web development and the like (but not new to programming) I have no clue what I am doing, so please be specific in your help.

All help is appreciated and thanks in advance!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I followed this tutorial to set up Rails and sqlite and everything works now! Thanks for the help Chris.

share|improve this answer

Sounds like your local MySql server is not running.

SQLite is easier - could you not use that instead?

On MySQL, not sure what guide you followed, but on this one, about halfway down, there is a bit about starting the mysql process:

After the installation, you can start up MySQL by running the following commands in a terminal window. You must have administrator privileges to perform this task.

If you have installed the Startup Item, use this command:

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start (Enter your password, if necessary) (Press Control-D or enter "exit" to exit the shell)

If you do not use the Startup Item, enter the following command sequence:

shell> cd /usr/local/mysql shell> sudo ./bin/mysqld_safe (Enter your password, if necessary) (Press Control-Z) shell> bg (Press Control-D or enter "exit" to exit the shell)

You should be able to connect to the MySQL server, for example, by running /usr/local/mysql/bin/mysql.

Perhaps that is what you need to do?

HTH, Chris

share|improve this answer
    
I don't have that startup item, and mysql is not located in /usr/local on my computer. MacPorts likes to install to /opt/local/var, but running which mysqld_safe turned up nothing. I tried installing mysql with the installer on their site and that ended up not working at all (I got a lot of errors in the installation, and I'd rather use MacPorts anyways). I would use something other than mysql, but that's what this tutorial uses (and I bet it's what the rest of this book uses) and since I'm new to this stuff I'd rather use the verbatim instructions. –  adam_0 Jul 19 '10 at 7:41
    
I ended up uninstalling mysql from MacPorts and went to install mysql from their website, but I am confused as far as which file(s) I should download. Then again, I don't really know what I need for what I need to do. How different is SQLite from mysql? –  adam_0 Jul 19 '10 at 8:05
    
SQLite is a lot simpler, its (or at least can be) an in-memory db, so no separate process to run, storing data in the local filesystem. –  Chris Kimpton Jul 19 '10 at 14:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.