Install MySQL on Linux/UNIX
MySQL is mostly installed as part of LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It uses SQL (Structured Query Language) for data management.
The installation of MySQL on Ubuntu is very simple. We have installed MySQL for you. In our case, we list all you need to do when you install MySQL server independently on Ubuntu Linux. The actual operation may vary slightly depending on the version. You can just omit this chapter and start the next part, it doesn't affect anything. After the installation, we will be able to start it from the Linux terminal.
It follows the steps below:
- Update the package index.
- Install MySQL-Server.
- Execute the included security script.
At this point, your Ubuntu system should be up and running. Launch the terminal from the launcher. Run the following command on the terminal to update the package index:
sudo apt-get update
Next, run the following command to install the mysql-server
:
sudo apt-get install mysql-server -y
Wait for the installation to complete. During the installation, you will be prompted to set the password for the MySQL root user. Enter the password and confirm it. This will install MySQL on your system. Once the installation is complete, the MySQL service will start automatically. You can verify it by running the following command:
sudo service mysql start
* Starting MySQL database server [ OK ]
Then, run the following command to initiate the configuration:
mysql_secure_installation
You will then be taken through a sequence of steps for which you will be expected to type "Y" for "yes" and any other key for "no". If you need additional security measures other than password protection, then you can type "Y", otherwise, type any other key and then hit the enter key to proceed. Do this for every step until you are done when the terminal prompt is returned to you.
Congratulations, you have just set MySQL on your Ubuntu Linux!