how to emulate "su mysql" in ubuntu?

Tom H tomh0665 at
Wed Jul 28 16:01:36 UTC 2010

On Wed, Jul 28, 2010 at 11:52 AM, Robert P. J. Day
<rpjday at> wrote:
> On Wed, 28 Jul 2010, Steve Flynn wrote:
>> On Wed, Jul 28, 2010 at 4:29 PM, Robert P. J. Day <rpjday at> 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.
>  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.  but on
> ubuntu, apparently not.  i could assign a login password to the mysql
> account, but i was wondering if there was some other way to do this.
>  i hope i'm not writing total gibberish but, just to be clear, what
> i'm obviously after is a command line session for which "id" tells me
> that i am the "mysql" account.  and while i'm sure that was easy on
> fedora, i can't use the same technique here.

sudo -i -u mysql

More information about the ubuntu-users mailing list