# Continuation

**URL:** <https://www.ruby-forum.com/t/continuation/80228>\
**Category:** Rails\
**Created:** [December 22, 2006, 3:07pm UTC](https://www.ruby-forum.com/t/continuation/80228 "2006-12-22T15:07:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 22, 2006, 3:07pm UTC](https://www.ruby-forum.com/t/continuation/80228/1 "2006-12-22T15:07:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 22, 2006, 3:11pm UTC](https://www.ruby-forum.com/t/continuation/80228/2 "2006-12-22T15:11:34Z")

</div>

See my post about using sudo - this is essentialy the same thing…

You are running the command as the root user on your machine.

---

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 22, 2006, 9:14pm UTC](https://www.ruby-forum.com/t/continuation/80228/3 "2006-12-22T21:14:28Z")

</div>

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 B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 22, 2006, 9:30pm UTC](https://www.ruby-forum.com/t/continuation/80228/4 "2006-12-22T21:30:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 26, 2006, 12:43pm UTC](https://www.ruby-forum.com/t/continuation/80228/5 "2006-12-26T12:43:21Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Prithvi\_Krishna\_Man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@Prithvi\_Krishna\_Man](https://www.ruby-forum.com/u/Prithvi_Krishna_Man)\
**Post date:** [December 22, 2006, 10:36pm UTC](https://www.ruby-forum.com/t/continuation/80228/6 "2006-12-22T22:36:55Z")

</div>

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 B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
