This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Invoking .bashrc when su to mysql?

Hi all,

Running Ubuntu 10.04 (meerkat).

I'm pretty new to Unix and there's one thing I don't seem to quite have grasped.

I created a user mysql and gave them a home directory /home/mysql.

Now, I have an environment configured when logging in as myself and I would like to bring that environment with me so to speak when I su to mysql.

Plain su gives nothing.I googled and found su -l mysql. This works

  • _sort of_* - my prompt is a mess, i.e. \[\e]0;\u@\h: \w\a\]\u@\h:\w$ and I don't have the command history with the arrow keys.

I appear to be invoking just /bin/sh as opposed to /bin/bash.

Could some kind soul explain to me how I can invoke the bash shell on executing the su command as myself?

TIA and regards.

Ellen

Answer Answered by Daniel Bartholomew in this comment.

Edit the /etc/passwd file, locate the mysql user, and change their shell from /bin/sh to /bin/bash.

Then copy over your .bashrc file from your home directory into the home directory of the mysql user.

Once you've done that, when you su -l mysql you should get everything you expect.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.