I am trying to use my first "hello world" example using a rails getting started guide on my OSX 10.6. 3.
When I go to execute the first command rake db:create(I use mysql), I get:
simon@/Users/simon/source/rails/blog/config: rake db:create (in /Users/simon/source/rails/blog) Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"blog_development", "pool"=>5, "password"=>nil, "socket"=>"/opt/local/var/run/mysql5/mysqld.sock"}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)
I found many stackoverflow questions addressing this issue with the following tips:
Make sure the user and password are correct (I run w / no password for root in my dev block)
Make sure the socket is correct - I can cat the socket, so I assume it is correct
Make sure that the user can create the database (since you can see that root can connect and create this database without any problems)
simon @ / Users / simon / source / rails / blog / config: mysql -uroot -hlocalhost Welcome to the MySQL monitor. The teams end; or \ g. Your MySQL connection identifier is 16 Server version: 5.1.45 Source distribution
Enter "help"; or '\ h' for help. Type '\ c' to clear the current input statement.
mysql> create database blog_development; Request OK, 1 row affected (0.00 sec)
to make sure this is not an encoding issue that I also tried:
mysql> create database foobar CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
Note: here is my database.yaml:
development:
adapter: mysql
encoding: utf8
reconnect: false
database: blog_development
pool: 5
username: root
password:
socket: /opt/local/var/run/mysql5/mysqld.sock
Please note that I tried switching the socket to localhost without effect.
Any idea what could happen here?
source
share