rake db:create == Protocol error

Hi,

I'm attempting to follow this tutorial:

To create a simple RoR app connected to a MySQL database. When I get to the point where I have to run "rake db:create" I get the error "Protocol error - db:migrate". E.g:

root@ubi:/home/greg/dev/library# rake db:create       create Protocol error - db:create root@ubi:/home/greg/dev/library#

I have no idea what this means and can find no information after extensive googling. I'll provide as much info about my environment/ setup as I know how to provide...

Any help or suggestions as to how I can figure this out? Please......

Thanks, Greg

Have you created the library_development, library_test, and library_production databases? These need to be in place in mysql prior to any db:migrate calls.

development:   adapter: mysql   encoding: utf8   reconnect: true   database: library_development   pool: 5   username: root   password: xxxxxxxx   host: localhost

This should be fine. You don't need to specify the socket. Are you connecting on a particular port? If you are, you need to specify the port if it's different than the normal 3306 I believe for mysql...

Thanks for the response.

I'm actually just trying to get db:create to work first (although I did try db:migrate to no avail). Surely db:create should work with just "development" defined in the yml and existing in MySQL ???

I will try creating and defining all three, just to be sure...

Greg wrote:

Thanks for the response.

I'm actually just trying to get db:create to work first (although I did try db:migrate to no avail). Surely db:create should work with just "development" defined in the yml and existing in MySQL ???

I will try creating and defining all three, just to be sure...

Yep, db:create works for development only while db:create:all works with all specified environments listed in your database.yml file.

You don't need the socket and you don't need the root@ubi line either...

Hmmm...

Thanks - I've tried it with "host: localhost" instead of socket, but neither works - still get the "Protocol" error...

Any ideas?

Yup that works.

greg@ubi:~$ irb1.8 irb(main):001:0> require 'mysql' => true irb(main):002:0>

So what does that mean?

Hi Greg,

That's a good thing - means your gem for mysql is fine. I would try a few other things - it really sounds like it's on the server side of mysql..

What version of mysql are you running?

I would create the library_development DB from scratch and try to migrate your beginning data using db:migrate. You will find out right away if there is a communication error. It could be that there's an authentication error or a trouble with communication to the server.

I've seen this exact error when I tried to use the newest version of mysql and so I had to go back to an older version. If this gives you a lot of issues, you could try going to sqlite3 or postgresql..