[nSLUG] Rails and mysql

Bill Davidson bdavidso at supercity.ns.ca
Fri Mar 10 10:02:20 AST 2006


Hi:

I see two problems:

1) There is a table called "Members", but you are trying to use a table
called "Member", hence the error message "try creating a table for your
model (Member)".

2) Why the reference to a named socket (/var/lib/mysql/mysql.sock) when
you are conjnecting to a remote host via TCP?  I don't know what these
*.yml files are or what they are used for, but I think you can connect
to a mysql database either locally through a socket, or locally or
remotely via TCP/IP.

On Thu, 2006-09-03 at 23:18 -0400, Rick Wightman wrote:
> Hello,
> 
> I'm attempting to develop a simple Rails app that contacts a mysql  
> server on another machine. Both machines are running FC4 with mysql  
> 5.0.16-standard. Previously the server had run 3.x. I have stopped  
> the server, rpm -e all things sql I could find, removed /var/lib/ 
> mysql and installed the server and client rpms for 5.0.16 (or at  
> least that's what I think I did), and reset the root password. This  
> would, I believe, have given me a clean slate with long passwords.
> 
> 
> A client connection to the database reveals:
> 
> [rick at outweb newlife]$ mysql newlife_development -h tertius  -u root -p
> Enter password:
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
> 
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 14 to server version: 5.0.16-standard
> 
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
> 
> mysql> show tables;
> +-------------------------------+
> | Tables_in_newlife_development |
> +-------------------------------+
> | Members                       |
> +-------------------------------+
> 1 row in set (0.00 sec)
> 
> mysql>
> 
> which I'm happy with. BUT running the following on the client machine  
> craps out:
> 
> [rick at outweb newlife]$ script/generate scaffold Member Admin
>        exists  app/controllers/
>        exists  app/helpers/
>        exists  app/views/admin
>        exists  test/functional/
>    dependency  model
>        exists    app/models/
>        exists    test/unit/
>        exists    test/fixtures/
>     identical    app/models/member.rb
>     identical    test/unit/member_test.rb
>     identical    test/fixtures/members.yml
>         error  Before updating scaffolding from new DB schema, try  
> creating a table for your model (Member)
> [rick at outweb newlife]$
> 
> 
> This makes me think that it can't connect to the server(??!!)
> 
> The config/database.yml is listed as:
> 
> [rick at outweb config]$ more *.yml
> # MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
> #
> # Get the fast C bindings:
> #   gem install mysql
> #   (on OS X: gem install mysql -- --include=/usr/local/lib)
> # And be sure to use new-style password hashing:
> #   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
> development:
>    adapter: mysql
>    database: newlife_development
>    host: tertius
>    username: xxxx
>    password: xxxx
>    socket: /var/lib/mysql/mysql.sock
> 
> where username and password match the previous commandline client  
> connection.
> 
> My experience with all of this is quite thin. As always any  
> illuminating information in any form is greatly appreciated.
> 
> 
> 
> Rick Wightman
> 
> 
> 
> 
> 
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug
> 
> 
> 
-- 
Bill Davidson
bdavidso at supercity.ns.ca

!DSPAM:4411870248892187310922!




More information about the nSLUG mailing list