MySQL is an open source database management system. It help to organize and retrieve data from SQL database.
MySQL work well with Apache and PHP. Hence it is used as backbone for most of website which needs and performs most database transactions.

Install MySQL Server on Linux OS
To install MySQL, enter following command in terminal:
1 |
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql |
Above command install three programs, one install MySQL server. Second, install module to authorize and use Apache server with MySQL. Third, make MySQL work with PHP program.
During installation, MySQL may ask you to create and set a root password. If you miss to set MySQL root password, you will have chance to set or change password later too.
Once you have MySQL in root, install MySQL DB on server using below command.
1 |
sudo mysql_install_db |
After installation, enter following command to install MySQL and run it securely.
sudo /usr/bin/mysql_secure_installation
Running first time might prompt you to enter password that you have set in earlier steps. If you haven’t set any password, simply press enter.
Going ahead, it will ask to secure MySQL server, enter Y or N based on your requirement. We would recommend to enter Y in every request.
1 |
Remove anonymous users? [Y/n] y |
1 |
Disallow root login remotely? [Y/n] y |
1 |
Remove test database and access to it? [Y/n] y |
1 |
Reload privilege tables now? [Y/n] y |
Enter exit command to close MySQL connection and move to root folder.
Once you have installed and ran MySQL, you need to restart Apache server to make it work effectively.
1 |
sudo service apache2 restart |
Hence now you have completed installation and enabling MySQL server on Linux OS.