1

I'm trying to configure my rails application with MySQL. When start my application, i get this error

Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock

I have installed rails in /opt/local/bin/rails folder.

MySQL is installed in /usr/local/mysql/ folder

What do I need to do to make this work?

Thanks.

1
  • This sounds like either your database.yml file isn't configured right or the mysql server is not running. Commented Apr 2, 2011 at 21:16

1 Answer 1

6

You need to find out where your socket is. If you have a mac it is normally /tmp/mysql.sock. then go into your config/database.yml file and change the socket.

development:
  adapter: mysql2
  database: your_db
  username: root
  socket: /tmp/mysql.sock

Good luck.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.