MySQL DBA - Tips and Techniques Magazine

13 Nov 2014

Setting Up mysql_profile

To make life easier, this profile needs to be created on every MySQL server we log on.

 

Connect as root and create the following file with correct locations.

 

 

cd /

 

touch /mysql_profile

 

chmod 600 /mysql_profile

 

vi /mysql_profile

 

 

export ERRORLOG=/local/db/mysql      

export DATADIR=/local/db/mysql      

export MYCNF=/etc

export SCRIPTDIR=

export BACKUPDIR=/var/mysql-backups

 

# some useful aliases

alias a='tail -500 $ERRORLOG/mk-stxx-1'

alias h='fc -l'

alias j=jobs

alias k='ls -lh'

alias g='egrep -i'

alias l='ls -alhrt'

alias df='df -h'

alias d='ls -lhrt | grep ^d'

alias p='ps -ef'

. /opt/tiscali/snmp/scripts/mysql/mySQL-conf.conf

alias m='mysql -u$user -p$pswd'

alias pass='cat $SCRIPTDIR/mySQL-conf.conf'

 

# Prompt

PS1=" `hostname` \${PWD} >"

export PS1

 

 

 

Then when logging onto a box, just run this profile and use the settings to get around easily.

 

sudo bash

. /mysql_profile

No comments:

Post a Comment