Added on May 21st, 2012 and marked as database install mysql

To install MySQL, run the following command from a terminal prompt:

apt-get install mysql-server

This will also install mysql-client, so it is not necessary to specify it explicitly. During the installation process you will be prompted to enter a password for the MySQL root user.

Once the installation is complete, the MySQL server should be started automatically. You can run the following command from a terminal prompt to check whether the MySQL server is running:

netstat -tap | grep mysql

When you run this command, you should see the following line or something similar:

tcp        0      0 localhost:mysql         *:*                     LISTEN      2556/mysqld

If the server is not running correctly, you can type the following command to start it:

service mysql restart

InnoDB

Since version 5.5 MySQL uses InnoDB as its default storage engine. By default the InnoDB data will be stored in a single file, /var/lib/mysql/ibdata1, and this file could grow really big.

This file has a initial size of 10Mb and it automatically extends. InnoDB data files can’t shrink, they only expand. DELETE, TRUNCATE, DROP etc. will not free up diskspace, instead, freed regions are marked as unused and can be reused later. It is possible to specify a limit in my.cnf, but none is set by default (therefore the data file will increase until all diskspace is consumed :().

It is possible to configure MySQL to use a separate data file for each InnoDB table by using the innodb_file_per_table option:

Add the following line to /etc/mysql/my.cnf:

[mysqld]
# Use separate data files for each table.
innodb_file_per_table

and restart MySQL.