How to Start-Stop MySQL Server on CentOS Server

This small post is to explain how you can start/stop/restart MySQL server from command line on CentOS Server.
Stop MySQL Server

# /etc/init.d/mysqld stop
Start MySQL Server

# /etc/init.d/mysqld start
Restart MySQL Server

# /etc/init.d/mysqld restart
Hope you find this small tip useful

Restore MySQL Database from FileSystem Backup

Always backup your  MySQL database with mysqldump but if you didn’t you can restore it from file system.

If your backup include the /var/lib/mysql directory, if so then you should be able to restore the database. Each database is contained in a separate subdirectory off /var/lib/mysql, so look for one named with the name of your database (WordPress or any other). To restore it, shutdown the mysql server first

sudo /etc/init.d/mysql stop

Copy the backup-ed directory into the same location on your new server, then restart mysql server

sudo /etc/init.d/mysql start

Note:- that its much better to take actual database dumps using the mysqldump command than to rely on this method. so for the future, you should schedule something like this:

mysqldump -h host -u user -ppassword --databases database1 database2 > myfile.dump


How-to enable gzip support on Nginx Plesk12

Create /etc/nginx/conf.d/gzip.conf with the following:

vim /etc/nginx/conf.d/gzip.conf
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;

restart ngix service from Plesk or ssh
gzip_types to compress other file types can be obtained from /etc/nginx/mime.types

Changing the domain in WordPress Multi Site.

If you have to or want to change the domain of your WordPress MU site. The domain name is actually stored in different places in the database, as well as online in wp-config.php. Every instance of these will need to be changed.

Before you do anything create a  backup. Go to phpMyAdmin, select your database, and choose Export. Save it to your computer. We’ll be making a copy of this and working on the copy. This way, if anything goes wrong, we still have our backup.

Continue reading…

WordPress Subfolder Multisite .htaccess file

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

How to install VNC server on CentOS 6

When we install the minimal copy of CentOS Server, it only gives us the “Command Line” interface.But some people prefer GUI instead and for this they install Full version of Gnome on CentOS. Actually there is a better way and that is to install VNC. VNC provides a lightweight virtual desktop than full blown version of Gnome.

To run the VNC Server on CentOS, we have to install these required packages:
sudo yum groupinstall Desktop
sudo yum install tigervnc-server
sudo yum install xorg-x11-fonts-Type1
To start VNC Server on boot
Continue reading…