http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html#resetting-permissions-unix
pkg_delete -x mysql
It is not clear what caused this, but this is how it was fixed – eventually! The main issue that resulted from the failure was that the database would not restart and there were 1000's of relay log files in the $DATADIR
- Killed all mysql processes and mysqld processes – had to use kill -9 for mysqld process
- Removed all relay bin logs from $DATADIR
- Restarted mysql using /usr/local/mysql/bin/mysqld_safe &
- Stopped slave
- Systems team stop mail
- Recreated slave from master (oook)
- Connect to database and issue 'flush logs'
- Set master log file and llog file position
- Restart slave …
backup_dbs_anyprov.sh
#!/bin/sh
#script to take consistent backup of ANYPROV database
date=`/bin/date +"%d-%m-%y-%H"`
umask 066
( /usr/local/bin/mysqldump -uroot –p** --databases ANYPROV --lock-all-tables | gzip) > /var/mysql-backups/anyprov-$date-`hostname -s`.sql.gz 2> /var/mysql-backups/anyprov-$date-`hostname -s`.sql.err.log
B. Take a no-data DDL dump of selected tables from a single database :
backup_dbs_anyprov_nodata.sh
#!/bin/sh
#script to take no-data backup of ANYPROV database selected tables
date=`/bin/date +"%d-%m-%y-%H"`
umask 066
( /usr/local/bin/mysqldump -uroot –p*** --no-data ANYPROV PROVSERVICEVW REPORTGEN | gzip) > /var/mysql-backups/anyprovnd-$date-`hostname -s`.sql.gz 2> …
[Read more]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 …
[Read more]SINGLE USER:
To see which grants a user has do
show grants for sdas;
+-----------------------------------------------------------------------------------------------------+
| Grants for sdas@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'sdas'@'%' IDENTIFIED BY PASSWORD …
[Read more]/usr/local/bin/mysqldump -uroot --p*** --databases prequal --lock-all-tables | gzip) > /home/backup/rebuild_prequal-`hostname -s`.sql.gz 2> /home/backup/rebuild_prequal-`hostname -s`.sql.err.log
I kept an eye on the database, and it queued all of the inserts until the backup finished, but allowed the selects to go through, an example of processlist is attached. Maybe we should consider this for some of the smaller databases and slaves
Apart from the start/stop commands the below commands show the different commands that can also be used to start and stop mysql daemon especially if you have encountered the following errors when you were using the 'normal' start/stop commands:
ERROR! MySQL manager or server PID file could not be found!
Starting MySQL.................................. ERROR
1: On the server Search for mysqld_safe
cd /
find . -name mysqld_safe -print
(ie found : ./usr/local/mysql_5.0.24/mysql-standard-5.0.24a-freebsd6.0-i386/bin/mysqld_safe )
2: To Start mysql daemon:
cd /usr/local/mysql_5.0.24/mysql-standard-5.0.24a-freebsd6.0-i386/bin
./mysqld_safe --user=mysql &
3: To Stop mysql daemon:
cd …
[Read more]090326 12:30:54 [ERROR] Got error 134 when reading table './ANYPROV/ORDERS'
Reference from Mysql Bug Database
http://lists.mysql.org/mysql/51228
perror 134
and get this result:
Unknown error 134
Record was already deleted (or record file crashed)
mysql> check table ORDERS;
+----------------+-------+----------+-------------------------------+
| Table | Op | Msg_type | Msg_text |
+----------------+-------+----------+-------------------------------+
…
[Read more]