Sunday, June 21, 2015

Shrink/Purge ibdata1 file in MySQL

1) Do a mysqldump of all databases procedures, triggers etc except the mysql and performance_schema databases
mysql -u username -p --database databasename > databasename.sql

2) Drop all databases
drop database databasename

3) Stop mysql
service mysqld stop

4) Delete ibdata1 and ib_log files
rm -rf /mnt/data/ibdata1
rm -rf /mnt/data/ib_logfile*

5) Start mysql
service mysqld start

6) Restore from dump
mysql -u username -p
You will get a mysql prompt and fire the below 2 commands there. Fire the
command where you have put the sql backup
mysql> source databasename.sql


Your database is purge :)

Saturday, June 20, 2015

How to install Apache from tar file

First download the tar file. We are installing httpd - 2.4.9

wget "http://archive.apache.org/dist/httpd/httpd-2.4.9.tar.bz2"


tar xvjf httpd-2.4.9.tar.bz2
cd httpd-2.4.9
cd srclib/
wget http://mirror.apache-kr.org//apr/apr-1.5.1.tar.gz
wget http://apache.petsads.us//apr/apr-util-1.5.4.tar.gz
tar xvfz apr-1.5.1.tar.gz
tar xvfz apr-util-1.5.4.tar.gz
mv apr-1.5.1 apr
mv apr-util-1.5.4 apr-util
cd ..

./configure --prefix=/usr/local/apache2 --enable-so --with-included-apr --enable-expires --enable-file-cache --enable-cache --enable-ratelimit --enable-log-debug --enable-usertrack --enable-unique-id --enable-remoteip --enable-proxy --enable-proxy-ajp --enable-proxy-http --enable-proxy-balancer --enable-session --enable-ssl --with-mpm=event

make
make install

Now Installtion is complete

Now start the apache
cd /usr/local/apache2/

./bin/apachectl start

Goto webbrowser and check
http://localhost