Forum: Ruby on Rails continuation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
05ca55586d3824efb5819ada42f44fb6?d=identicon&s=25 Prithvi Krishna Mandava (Guest)
on 2006-12-22 15:07
(Received via mailing list)
in continuation to my earlier mail,

if i entered the command

> mysql -u root -p depot_development <db/create.sql


instead of

> mysql depot_development <db/create.sql


then it works. can anyone please enlighten me on whats happening?
mysql is configured with a blank password for root@localhost.

thank you,


--
Prithvi Krishna Mandava
(91)9880067859
B3bcedc723a39bd0395f3c68cbca49e4?d=identicon&s=25 toby privett (Guest)
on 2006-12-22 15:11
(Received via mailing list)
See my post about using sudo - this is essentialy the same thing..

You are running the command as the root user on your machine.
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-12-22 21:14
(Received via mailing list)
On Dec 22, 2006, at 9:10 AM, toby privett wrote:
>> instead of
>> Prithvi Krishna Mandava
>> (91)9880067859
>>  >

No, sudo runs a command as the user 'root' on the operating system
(assuming Unix-like)

The user named 'root' for MySQL is all-powerful, but only within the
database, not the entire system.

I suspect that you're logged in as a user named 'ODBC' or perhaps
there is an environment variable that mysql picks up as the user
(try:  env | grep -e ODBC ).  Doing the initial creation of the
database (i.e., depot_development) is often done as the "mysql -u
root" user, but then you typically also create a user to be used for
that database (doesn't have to be exclusive) and the tables within
that database are created by the non-root user.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
05ca55586d3824efb5819ada42f44fb6?d=identicon&s=25 Prithvi Mandava (mandava)
on 2006-12-22 21:30
(Received via mailing list)
I created the databases and tables from root like this:

depot> mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> create database depot_development;
mysql> create database depot_test;
mysql> create database depot_production;
mysql> grant all on depot_development.* to 'dave'@'localhost';
mysql> grant all on depot_test.* to 'dave'@'localhost';
mysql> grant all on depot_production.* to 'prod'@'localhost' identified
by 'wibble';
mysql> exit

and then editing database.yml to remove the username and password from
the tables for development and test.
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-12-22 22:36
(Received via mailing list)
On Dec 22, 2006, at 12:45 PM, Mandava wrote:
> mysql> grant all on depot_production.* to 'prod'@'localhost'
> identified
> by 'wibble';
> mysql> exit
>
> and then editing database.yml to remove the username and password from
> the tables for development and test.

Do you mean that you *changed* the username to "dave" and removed the
password?

You could then generate your depot_development tables with:

mysql -u dave depot_development < db/create.sql

(from memory so please forgive any typos)

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
05ca55586d3824efb5819ada42f44fb6?d=identicon&s=25 Prithvi Mandava (mandava)
on 2006-12-26 12:43
(Received via mailing list)
its working but i kinda don remember wat exactly i was doing!!
i was getting frustrated with the total lack of explanation in the book
about the syntax. the authors assume you have expert-level knowledge in
everything other than ROR.. and they take it for granted..
This topic is locked and can not be replied to.