Sunday, May 30, 2010

Mysql Crash Recovery

Mysql Crash Recovery

1) Verify the current process and status
========================================

ps auxf | grep mysql By this command we can find any mysql process in the server.

ps -aux | grep mysql

The -a option tells ps to list the processes of all users on the system rather than just those of the current user, with the exception of group leaders and processes not associated with a terminal. A group leader is the first member of a group of related processes.

The -u option tells ps to provide detailed information about each process.

The -x option adds to the list processes that have no controlling terminal, such as daemons, which are programs that are launched during booting (i.e., computer startup) and run unobtrusively in the background until they are activated by a particular event or condition.

The output of the command is

>ps -aux | grep mysql

root@cpmouse [/var/lib/mysql]# ps auxf | grep mysql
root 16673 0.0 0.0 61128 712 pts/1 S+ 18:30 0:00 \_ grep mysql
root 11142 0.0 0.0 10796 1160 ? S 06:24 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/cpmouse.ecdsystem.com.pid
mysql 11163 39.2 1.4 442900 59584 ? Sl 06:24 284:47 \_ /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/cpmouse.ecdsystem.com.pid --skip-external-locking

To check the mysql current processes

ps -ef |grep mysql|awk '{print $2}'

This command will grep the second column only.


2)Verify /etc/my.cnf settings

[mysqld]
safe-show-database
old-passwords = 1

skip-name-resolve
skip-locking
set-variable = max_connections=2000
set-variable = interactive_time=30
set-variable = wait_timeout=30
set-variable = max_connect_errors=2000

3)Have a look out the mysqld Permission settings
=================================================

The Permission should be in mysql format

chown mysql.mysql /var/run/mysqld


We have to change the ownership for all the mysql processes.

chown -R mysql.mysql /var/run/mysqld

root@cpmouse [/var/lib/mysql]# ll
total 20556
drwxr-xr-x 4 mysql mysql 4096 May 30 04:29 ./
drwxr-xr-x 29 root root 4096 May 30 04:21 ../
-rw-rw---- 1 mysql root 5378 May 30 04:29 cpmouse.ecdsystem.com.err
-rw-rw---- 1 mysql mysql 5 May 30 04:29 cpmouse.ecdsystem.com.pid
-rw-rw---- 1 mysql mysql 5 May 30 04:28 cpmouse.pid
-rw-rw---- 1 mysql mysql 10485760 May 30 04:29 ibdata1
-rw-rw---- 1 mysql mysql 5242880 May 30 04:29 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 May 30 04:26 ib_logfile1
drwx--x--x 2 mysql mysql 4096 May 30 04:22 mysql/ - contain mysql user privilege
srwxrwxrwx 1 mysql mysql 0 May 30 04:29 mysql.sock=
drwxr-xr-x 2 mysql mysql 4096 May 30 04:21 test/

/var/lib/mysql - remove
/usr/sbin/mysqd - remove

grant all privileges on virus_UC.* to virus_UC@localhost identified by '04241988';

/scripts/mysqlup --force

/var/cpanel/cpanel.config

No comments:

Post a Comment