Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Friday, August 07, 2009

Mysql is not running but lock exists issue

/etc/init.d/mysql status

coming back with:

mysql is not running but lock exists


Solved by removing the lock file:

rm /var/lock/subsys/mysql

Sunday, July 12, 2009

MySQL Error : mysql is not running but lock exists

/etc/init.d/mysql status


coming back with:

mysql is not running but lock exists


Solved by removing the lock file:

rm /var/lock/subsys/mysql

Saturday, March 28, 2009

Locate Table Consuming High Resources

You need to install perl modules:-

cpan -i Term::ReadKey
cpan -i Term::ANSIColor
cpan -i Time::HiRes


after that, install mytop

wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
tar -zxvf mytop-1.6.tar.gz
cd mytop-1.6
perl Makefile.PL
make
make test
make install


mirror : wget http://notepad.harithdawi.com/files/mysql/mytop-1.6.tar.gz

execute below command (mydb is the database name)

mytop -u dba -p 'password' -h 10.2.4.5 -d mydb



  • -u : Database username.

  • -p : Database password.

  • -h : Database server IP address.

  • -d : Database name

Sunday, January 25, 2009

Importing SQL Databases via command

Most backups of databases use utilities such as mysqldump to generate a SQL insert statements and data that describes the old database. SQL files are also used when creating new databases. To import these .sql files, use the following command (when logged into the server via SSH):

mysql -u username -ppassword database_name < your_data.sql

This command loads all the SQL commands from the specified file as if you were to enter them line by line.

Optimize Apache & MySQL for Low Memory Systems

Optimize Apache for Low memory Server

/etc/httpd/conf/httpd.conf

KeepAlive On
KeepAliveTimeout 3
<IfModule prefork.c>
StartServers       2
MinSpareServers    2
MaxSpareServers    5
ServerLimit      100
MaxClients       100
MaxRequestsPerChild  500
</IfModule>
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     15
MaxSpareThreads     50
ThreadsPerChild     15
MaxRequestsPerChild  0
</IfModule>

Optimize MySQL for Low Memory Server

/etc/my.cnf

[mysqld]
port               = 3306
socket             = /var/lib/mysql/mysql.sock
skip-locking
key_buffer         = 16K
max_allowed_packet = 1M
table_cache        = 4
sort_buffer_size   = 64K
read_buffer_size   = 256K
read_rnd_buffer_size = 256K
net_buffer_length  = 2K
thread_stack       = 64K