MySQL

Find Out Which Repository an RPM is Installed From

You might be wondering which an rpm package came from. When yum info will list “installed” instead of which repository, well here is a one liner that can help:

rpm -q gpg-pubkey --provides | grep `rpm -qi |grep Signature|awk '{print $(NF)}'|tail -1`

Here is a sample:

[root@vm-linux-01 ~]# rpm -q gpg-pubkey --provides | grep `rpm -qi mysql-server|grep Signature|awk '{print $(NF)}'|tail -1`
gpg(Atomic Rocket Turtle ) = 4:32a951145ebd2744-418ffac9
gpg(5ebd2744) = 4:32a951145ebd2744-418ffac9

So we know that mysql-server came from the Atomic repo :)

Tags: , , ,

Monday, February 7th, 2011 Bash, Linux, MySQL No Comments

Quick Backup of All MySQL Databases

Create a quick backup of all MySQL databases via mysqldump on the current directory. Replace USERNAME and PASSWORD with your own.

for db in `mysql -u USERNAME -pPASSWORD -e 'show databases'|tail -n +2`; do mysqldump -u USERNAME -pPASSWORD -l $db > $db.sql; done;

Tags: , ,

Saturday, October 17th, 2009 Bash, Linux, Mac, MySQL, Unix No Comments