Planet MySQL Planet MySQL: Meta Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 3

Displaying posts with tag: sudo (reset)

Correctly setting your mysql prompt using sudo
+2 Vote Up -0Vote Down

If you run multiple MySQL environments on multiple servers it’s a good habit to set your MySQL prompt to double check which server you are on.
however, using the MYSQL_PS1 environment variable I found this does not work under sudo (the normal way people run sudo).

I.e., the following syntax’s work.

$ mysql
$ sudo su - -c mysql
$ sudo su - ; mysql

but the following does not.

$ sudo mysql

The trick is actually to ensure via /etc/sudoers you inherit the MySQL_PS1 environment variable.

echo "export MYSQL_PS1=\"`hostname` [\d]> \"" | sudo tee /etc/profile.d/mysql.sh
echo 'Defaults    env_keep += "MYSQL_PS1"' | sudo tee /tmp/mysql
sudo chmod 400 /tmp/mysql
sudo mv /tmp/mysql /etc/sudoers.d
ZRM for MySQL Issues
+2 Vote Up -0Vote Down
I really like ZRM for MySQL Community Edition for backups. I find
it very simple to install and configure and it gets the job done. It's default settings suits most installations. The challenges arise once you need to adapt it to more complex organizations. Please note that all the issues described on this article refer to Linux installations.

What If DBAs Have No sudo?

This was the 1st challenge that I ever faced. ZRM requires full root access at least during installation and in some cases, it requires some sudo permissions to be able to manage its files as well. Some organizations don't grant these permissions to the DBAs complicating the installation. When I looked into the scripts, I didn't see any reason why they wouldn't run in the user space, other than a few hard coded paths. I posted the

  [Read more...]
Installing sudo
+0 Vote Up -0Vote Down
To install sudo on a debian or ubuntu system with a bash shell (this is likely you if you're reading this), change to the root user thus:

$ su -


Now that you have a "#" shell, all commands you run will be privileged. You don't want this. Trust me. Instead, you want to run most commands as your usual user and only use privileged commands when you have no other choice. To do this, I recommend installing sudo.

# apt-get install sudo


When this program finishes installing, and you are again presented with a "#" shell, do the last thing you will ever do from that shell. In the following example, "<your username>" represents the username of your non-privileged user.

# echo '<your username>  ALL=(ALL) ALL' >> /etc/sudoers


If you substituted <your username> correctly, you











  [Read more...]
Showing entries 1 to 3

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.