In the following tutorial i will describe the steps to optimize the performance of a MySQL database with the mysqltuner script:

Step1. Download the mysqltuner script:

cd /usr/bin
 chmod +x

Step2.  Run mysqltuner:

[email protected]:~# /usr/bin/

Enter the root as username and the  password and you will get a output like this:

[email protected]:~# /usr/bin/

>>  MySQLTuner 1.2.0 - Major Hayden <[email protected]>
>>  Bug reports, feature requests, and downloads at
>>  Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.58-1~dotdeb.1
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

Continue Reading…

Watch is a very useful command to run another command periodically.
This is useful for monitoring queries that are causing your server to block.
- n 1 – is the number of secconds between queries.

watch -n 1 mysqladmin --user=root --password=yourpassword processlist

New category

Valic —  October 9, 2011 — Leave a comment

All posts in this category will be useful snippets of different categories such as: bash, linux, mysql, apache, htaccess, and why wordpress and more.

1. Configure The Master
First we have to edit /etc/mysql/my.cnf

We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):

#bind-address            =

Furthermorewe have to tell MySQL for which database it should write logs,which log file it should use, and we have to specify that this MySQLserver is the master. We want to replicate the database exampledb, so we put the following lines into /etc/mysql/my.cnf:

log-bin = /var/log/mysql/mysql-bin.log

# what database you want to replication



Then we restart MySQL:

/etc/init.d/mysql restart

Then we log into the MySQL database as root and create a user with replication privileges:

mysql -u root -p
Enter password:

GRANT REPLICATION SLAVE ON *.* TO ‘slave_user’@’%’ IDENTIFIED BY ‘<your_password>’;

Next do this:


Now leave the MySQL shell:

Continue Reading…

The following tutorial is done with Debian Squeeze version 6.0.2.
In this tutorial, I will show you the shortest and easiest way to set up nginx  with PHP5, MySQL and phpmyadmin running through FastCGI:

Step 1: Installation:

apt-get install nginx mysql-server mysql-client php5 php5-cgi php5-mysql phpmyadmin

NOTE: After you have installed all above you will need to edit the php.ini file:
Open php.ini file end remove the ; in front of the line cgi.fix_pathinfo=1

Step 2: Make PHP FastCGI daemon listening on port 9000 on localhost and start at boot.

Edit the /etc/rc.local file and put the following content:

vim /etc/rc.local
/usr/bin/spawn-fcgi -a -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/

Step 3: Create virtual host file for your site:

Continue Reading…

Page 2 of 212