LEMP (Linux, Nginx, Mysql, PHP) in Ubuntu 14.04

In this post, I will show step to run a simple site in nginx server, use FPM.

Install all packet with apt-get:

Create example.com file in /etc/nginx/site-available/

Add the content below to “example.com” file

And enable the site you created

Now for the test

MYSQL Command should remember

This is just to save some mysql command that sometimes I forget. The store is good for me when I need to look back and copy paste.

1. Faster import sql file

Export and Compress sql file:

Decompress and Import:

Create new user and pass:

Grant privileges:

List of the “in progress” process:


Install mysql 5.1 in ubuntu 14.04

How to install mysql 5.1 in ubuntu 14.04? Actually, it is easy to install mysql version 5.5. However, with version 5.1, it is so difference. You have to install this from source.

Download mysql 5.1 source code:

Uncompress the packet:

Install dependencies:

Install from source:

Create mysql data directory and mysql user

DB install

And try to run mysql


Change MYSQL data directory

Sometimes you need change mysql data directory for the reason expand hard disk driver or rearrange your directory structure. This tutorial will show you the way to change it in Ubuntu.

For example, change mysql data directory from /var/lib/mysql to /var/data/mysql

Looking for:

Change to :

And open file:

Looking for:

Change to:

Reload AppArmor profile:

Finally, restart MYSQL:

It’s done.

Different between MyISAM and InnoDB

MyISAM means MYSQL Indexed Sequential Access Method. Basically, It is a flat file, and is very old technology. But do not let that put you off using it. Because a flat file means it is not relational, and thus is not an RDBMS, and thus is more appropriate for some situations.
InnoDB is the full RDBMS like almost one you know.  InnoDB is great for if you have a lot of relational links (with references, joins, etc).

With MyISAM, It implements locking on the table, and while that lock is held, no other session can perform a SELECT. With InnoDB, It implements locking on the row.

Additional thing, MyISAM supports full-text search.

Both MyISAM and InnoDB are good. But when you design database you need determine if you need features provided by InnoDB. If not, then MyISAM is up for consideration.


Backup all databases of MYSQL

This is small tip to help you backup all database mysql by one command. And you also can use this command to backup database every night.

Using the command below:

Or using crontab to backup database every day: