I am currently developing in ruby on rails. I am using a web online service from the page Nitrous.io. It provides a text editor and a command line with all rails gems and programs you might need.
I want to use the mysql gem that is already installed, but when I run "mysql" it fires up the error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Both which mysql
and mysql --version
tell me, there is a mysql installed but I can't access it.
How can I access my database via the ruby gem?
I suspect your database may be on a different server than the Rails application. If that is the case, Rails won't be able to connect via /var/run/mysqld/mysqld.sock, but needs a network connection to that server. Check your database server credentials against config/database.yml
.