how to emulate "su mysql" in ubuntu?

Patrick Doyle wpdster at
Wed Jul 28 16:44:45 UTC 2010

On Wed, Jul 28, 2010 at 12:25 PM, Tom H <tomh0665 at> wrote:
> On Wed, Jul 28, 2010 at 12:03 PM, Patrick Doyle <wpdster at> wrote:
>> On Wed, Jul 28, 2010 at 12:00 PM, Robert P. J. Day
>> <rpjday at> wrote:
>>> On Wed, 28 Jul 2010, Patrick Doyle wrote:
>>>> I see that sudo takes a -u argument, perhaps
>>>> $ sudo -u mysql /bin/sh
>>>> might do the trick.
>>>  yes, that appears to work, but i could *swear* that was also one of
>>> the first things i tried.  i must have tested every subtle variation
>>> of that except for that.  argh.  thanks.
>> And, of course, Marius Gedminas gave the more elegant solution of:
>> $ sudo -u mysql -s
> sudo -s == su
> sudo -i == su -

Just in case anybody stumbles across this thread sometime in the future...

Tom & Marius go me curious, so I installed mysql-server on my Ubuntu
10.04 box an noticed that it created a mysql user with a login shell
of /bin/false.

So my first suggestion of

$ sudu -u mysql /bin/sh

would work, whereas using the -i and -s arguments wouldn't.  (Actually
$sudo -u mysql -s bash seems to work.)


More information about the ubuntu-users mailing list