MySQL

MySQL is a fast, multi-threaded, multi-user, and robust SQL database server. It is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.

Installation

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

sudo apt-get install mysql-server mysql-client

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:

sudo netstat -tap | grep mysql

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

tcp 0 0 localhost.localdomain:mysql *:* LISTEN -

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

sudo /etc/init.d/mysql restart

Configuration

By default, the administrator password is not set. Once you install MySQL, the first thing you must do is to configure the MySQL administrator password. To do this, run the following commands:

sudo mysqladmin -u root password newrootsqlpassword

sudo mysqladmin -p -u root -h localhost password newrootsqlpassword

You can edit the /etc/mysql/my.cnf file to configure the basic settings -- log file, port number, etc. Refer to /etc/mysql/my.cnf file for more details.