rake db:create == Protocol error

2 views
Skip to first unread message

Greg

unread,
Jul 2, 2009, 4:09:33 PM7/2/09
to Ruby on Rails: Talk
Hi,

I'm attempting to follow this tutorial:

http://www.tutorialspoint.com/ruby-on-rails/rails-database-setup.htm

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


==============================================
I am running Ubuntu:
root@ubi:/home/greg/dev/library# uname -a
Linux ubi 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC
2009 i686 GNU/Linux

I am using Mysql server version 5.0
root@ubi:/home/greg/docs/procedis/dev/library# mysql -V
mysql Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486) using
readline 5.2

I am using ruby 1.8.7
root@ubi:/home/greg/docs/procedis/dev/library# ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

I have the following:
*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
mysql (2.7)
rails (2.3.2)
rake (0.8.7)

This is my database yml file:
root@ubi:/home/greg/dev/library# more config/database.yml
development:
adapter: mysql
encoding: utf8
database: library_development
pool: 5
username: root
password: xxxxxxxx
socket: /var/run/mysqld/mysqld.sock
root@ubi:/home/greg/dev/library#

(I have also tried with "host: localhost" instead of socket)

I am able to connect to the mysql database using the dbconsole:

root@ubi:/home/greg/dev/library# ruby script/dbconsole
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>







Rick

unread,
Jul 3, 2009, 3:20:15 PM7/3/09
to Ruby on Rails: Talk
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.

Älphä Blüë

unread,
Jul 3, 2009, 3:27:42 PM7/3/09
to rubyonra...@googlegroups.com
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...
--
Posted via http://www.ruby-forum.com/.

Greg

unread,
Jul 3, 2009, 3:34:33 PM7/3/09
to Ruby on Rails: Talk
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...

Älphä Blüë

unread,
Jul 3, 2009, 3:38:48 PM7/3/09
to rubyonra...@googlegroups.com
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...

Älphä Blüë

unread,
Jul 3, 2009, 3:40:06 PM7/3/09
to rubyonra...@googlegroups.com
nm - the message was tied together with your console output..

Greg

unread,
Jul 3, 2009, 3:48:21 PM7/3/09
to Ruby on Rails: Talk
Hmmm...

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

Any ideas?



On Jul 3, 8:38 pm, "Älphä Blüë" <rails-mailing-l...@andreas-s.net>
wrote:

Älphä Blüë

unread,
Jul 3, 2009, 8:05:46 PM7/3/09
to rubyonra...@googlegroups.com
Well it's either mysql server related or your gem. Have you tried to
test whether or not your gem works?

irb
require 'mysql'
=> 'true'

?

Greg

unread,
Jul 4, 2009, 4:07:02 AM7/4/09
to Ruby on Rails: Talk
Yup that works.

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

So what does that mean?


On Jul 4, 1:05 am, "Älphä Blüë" <rails-mailing-l...@andreas-s.net>
wrote:

Älphä Blüë

unread,
Jul 4, 2009, 9:28:08 AM7/4/09
to rubyonra...@googlegroups.com
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..

Reply all
Reply to author
Forward
0 new messages