small medium large xlarge

Generic-user-small
22 Sep 2008, 09:57
Roy Stannard (10 posts)

Hi, My first post. I’m using AWDWR3, downloaded two days ago.

In the terminal, the command referred to on page 77 gives no output roy@prospero:~/programming/rails_apps/agile_rails/depot$ ruby script/generate scaffold product > title:string description:text image_url:string

No folders or files are created.

These gems are installed

gem query –local

** LOCAL GEMS **

actionmailer (2.1.1) actionpack (2.1.1) activerecord (2.1.1) activeresource (2.1.1) activesupport (2.1.1) fastthread (1.0.1) passenger (2.0.3) rack (0.4.0) rails (2.1.1) rake (0.8.2) sqlite3-ruby (1.2.4)

The rails depot command installed the folders and files as described.

Any help would be much appreciated

cheers Roy

Samr_small_pragsmall
22 Sep 2008, 13:07
Sam Ruby (634 posts)

The greater than sign is the prompt. If you enter all this on one line, drop both the backslash and the greater than sign.

Generic-user-small
22 Sep 2008, 14:58
Roy Stannard (10 posts)

Duh! thanks Sam. It works.

Actually, since my first post, I’ve been looking at using mysql rather than sqlite. My reasons are that I worked thru most of AWDWR2 and have some (little) familiarity with mysql and also I have some data in an mysql database that I will be using later.

So I set up a depot app with rails configured for mysql using rails –database=mysql depot that runs OK

But when I try to create a db I get an error message

roy@prospero:~/programming/rails_apps/agile_rails$ mysqladmin -u root create depot_development mysqladmin: connect to server at ‘localhost’ failed error: ‘Access denied for user ‘root’@’localhost’ (using password: NO)’

I have installed mysql and it seems to be working

roy@prospero:~/programming/rails_apps/agile_rails/depot$ mysqladmin version mysqladmin Ver 8.41 Distrib 5.0.51a, for debian-linux-gnu on i486 Copyright (C) 2000-2006 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.51a-3ubuntu5.1 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/run/mysqld/mysqld.sock Uptime: 6 hours 28 min 1 sec

and

roy@prospero:~/programming/rails_apps/agile_rails/depot$ mysqladmin version mysqladmin Ver 8.41 Distrib 5.0.51a, for debian-linux-gnu on i486 Copyright (C) 2000-2006 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.51a-3ubuntu5.1 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/run/mysqld/mysqld.sock Uptime: 6 hours 28 min 1 sec

I’ve also added host: localhost to database.yml

I’m not sure where to go from here. Maybe I ought to install the mysql gem.

Samr_small_pragsmall
22 Sep 2008, 15:35
Sam Ruby (634 posts)

Looks like you got a connection, but didn’t provide the right user and password. Check your config/database.yml. You can find more information on pages 72-73 in the B1.5 printing of the PDF.

Generic-user-small
22 Sep 2008, 16:45
Roy Stannard (10 posts)

Actually I meant to post mysql status info before mysql> status; ————– mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2

Connection id: 45 Current database: Current user: roy@localhost SSL: Not in use Current pager: stdout Using outfile: ‘’ Using delimiter: ; Server version: 5.0.51a-3ubuntu5.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 8 hours 8 min 15 sec

and the relevant section in database.yml

development: adapter: mysql encoding: utf8 database: depot_development username: root password: random # socket: /var/run/mysqld/mysqld.sock host: localhost

I’ve looked at 72-73 and I’m really not sure where to go from here.

I’m still getting this error

roy@prospero:~/programming/rails_apps/agile_rails/depot$ mysqladmin -u root -p create depot_development Enter password: mysqladmin: connect to server at ‘localhost’ failed error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’

Thanks for your help, I do appreciate it.

Roy

Generic-user-small
22 Sep 2008, 16:49
Roy Stannard (10 posts)

Sorry about the messed up database.yml details. I’m not sure why this happened

Here they are again development: adapter: mysql encoding: utf8 database: depot_development username: root password: random #socket: /var/run/mysqld/mysqld.sock host: localhost

Samr_small_pragsmall
22 Sep 2008, 17:06
Sam Ruby (634 posts)

Your mysql status indicates that your username is roy, but your database.yml tells rails to use root instead.

Generic-user-small
29 Sep 2008, 11:25
Roy Stannard (10 posts)

Success! I managed to solve the mysq db creaate problem.

Following the ‘last resort’ method at the end of

https://help.ubuntu.com/community/MysqlPasswordReset

From the console: sudo apt-get –purge remove mysql-server mysql-common mysql-client and sudo apt-get install mysql-server mysql-common mysql-client

this put up an input screen which allowed me to set user and password. Synaptic did not do this

Since I had no data to worry about, this method was a no-brainer.

Mysql is now working with rails 2,

Thanks for your help.

You must be logged in to comment