how to emulate "su mysql" in ubuntu?

Marius Gedminas marius at pov.lt
Wed Jul 28 15:59:44 UTC 2010


On Wed, Jul 28, 2010 at 11:52:32AM -0400, Robert P. J. Day wrote:
> On Wed, 28 Jul 2010, Steve Flynn wrote:
> 
> > On Wed, Jul 28, 2010 at 4:29 PM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
> > >
> > >  i just know i'm going to regret asking this, but how can i
> > > emulate the effect of doing "su mysql" in ubuntu?  i'm trying to
> > > recover a damaged mysql db and in the list of instructions is the
> > > note that you have to run the mysql server in rescue mode as the
> > > mysql user, so the page instructs one to "su mysql" first.
> > >
> > >  well, if i was on fedora, that would be easy.  but what's the
> > > equivalent on ubuntu?  is it simple?  or will it require editing
> > > /etc/sudoers and so on?
> >
> > What's wrong with "su - mysql"? I presume you know the mysql password.
> 
>   that was the first thing i tried, but that requires knowing the
> login password for the "mysql" account and there is none.  unless
> i've completely forgotten how user accounts work, a lot of the
> standard accounts are system or pseudo-user accounts which don't
> support a login session and therefore cannot be logged into.

Right.

>   IIRC, on fedora, i could still use "su" to invoke a terminal session
> that had, as its UID and GID, one of those system accounts.

It's not distro-dependent; su asks for a password if you're not root,
and doesn't ask for a password if you are root.

So you can do

  sudo su mysql

or just use sudo directly to get a shell as user mysql

  sudo -u mysql -s

Marius Gedminas
-- 
If vegetarians eat vegetables, what do humanitarians eat?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100728/dc7cb7b9/attachment.sig>


More information about the ubuntu-users mailing list