That explains why I've never used that :)  No passwords in dev here (no
passwords in prod either actually :)

On Thu, Jun 9, 2011 at 9:54 AM, Neal Clark <[email protected]> wrote:

> that makes perfect sense darren. thanks!
>
> something kinda neat: when i run db -p w/mysql 5.1.45, the password is
> actually masked in the process list:
>
> root      6455  1.9  0.0  38760  3288 pts/1    S+   16:49   0:01
> /usr/bin/mysql --user=myapp --host=
> my-identifer.us-east-1.rds.amazonaws.com --password=x xxxxxxxxx myapp
>
> i.e. the "x xxxxx.." part was already like that. i don't know when mysql
> started doing that, some blog post i just read says "recent versions of
> mysql." anyway, yeah, obviously not everyone is using mysql or a recent
> version, so the -p thing seems like a good idea.
>
> -n
>
> On Jun 9, 2011, at 9:31 AM, Darren Boyd wrote:
>
> > 'rails console' executes a Ruby process, and makes a database
> > connection through the ruby process.  If a password is required, it is
> > passed securely through the initialization of the connection.
> >
> > 'rails dbconsole' executes out to a shell process.  If you want
> > include the password on the shell process, it has to include it as a
> > parameter.  The command, with the password will look something like...
> >
> >  /usr/local/bin/mysql --user=root --host=localhost
> > --password=secret_password the_database
> >
> > The downside to passing it on the command line is that anyone else on
> > the system can see that password if they do something like...
> >
> >  $ ps auxww | grep mysql
> >
> > For people on shared systems, this is not very secure*.  Therefore,
> > you have to explicitly tell Rails to pass the password.
> >
> > Search for 'include_password' here:
> >
> https://github.com/rails/rails/blob/master/railties/lib/rails/commands/dbconsole.rb
> >
> > *completely depends on your definition of secure.
> >
> >
> > On Wed, Jun 8, 2011 at 8:25 PM, Neal Clark <[email protected]>
> wrote:
> >> something i've been curious about ...
> >>
> >> does anyone know why 'rails console' will give you access to the console
> where you can run arbitrary statements against that environment's database
> w/ActiveRecord::Base.connection.execute(), but you have to pass the '-p'
> flag to 'rails dbconsole' to get access? why not 'rails console -p', or
> 'rails dbconsole' (no -p)?
> >>
> >> i don't see the point. am i missing something? does anyone know how this
> came about?
> >>
> >> -n
> >>
> >> --
> >> SD Ruby mailing list
> >> [email protected]
> >> http://groups.google.com/group/sdruby
> >
> > --
> > SD Ruby mailing list
> > [email protected]
> > http://groups.google.com/group/sdruby
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to