MySQL is the most popular Open Source SQL database management system. It is developed and supported by Oracle Corporation. MySQL is widely use for Linux platform. Now MySQL providers also providing there own apt repository for installing MySQL on Ubuntu and Debian based systems. This article will help you to install MySQL database server on Ubuntu 14.04 LTS, 12.04 LTS and Debian 7 systems.
Step 1: Add Apt Repository
First add Apt repository in your debian based system provided by MySQL using below command as per your operating system.
For Ubuntu 14.04 LTS
$ wget http://repo.mysql.com/mysql-apt-config_0.3.2-1ubuntu14.04_all.deb $ sudo dpkg -i mysql-apt-config_0.3.2-1ubuntu14.04_all.deb
For Ubuntu 12.04 LTS
$ wget http://repo.mysql.com/mysql-apt-config_0.3.2-1ubuntu12.04_all.deb $ sudo dpkg -i mysql-apt-config_0.3.2-1ubuntu12.04_all.deb
For Debian 7
$ wget http://repo.mysql.com/mysql-apt-config_0.3.2-1debian7_all.deb $ sudo dpkg -i mysql-apt-config_0.3.2-1debian7_all.deb
Step 2: Install MySQL
Before installing MySQL execute following command to get the most up-to-date package information from the MySQL APT repository
$ sudo apt-get update
As we have updated packages information, Lets start MySQL installation using following command. It will install MySQL server packages and client packages.
$ sudo apt-get install mysql-server
During the installation, installer will prompt for entering password twice. which will by root password of MySQL server. Installer will also prompt to ask for creating test database. Say no for production servers.
Step 3. Start MySQL
To start the MySQL server use following command.
$ sudo service mysqld start
To check the status of the MySQL server or stop MySQL server using following commands
$ sudo service mysqld status $ sudo service mysqld stop