How to install MySQL in Ubuntu using the terminal
MySQL is an open-source relational database management system (RDBMS) that is widely used for managing and storing data. It is a popular choice for web applications and is known for its flexibility, performance, and ease of use. To install MySQL in Ubuntu using the terminal, follow the steps below:
Open a terminal window on your Ubuntu system. You can do this by pressing Ctrl+Alt+T simultaneously or by searching for "Terminal" in the application launcher.
Update the package list by running the following command:
sudo apt update
Once the package list is updated, you can proceed with the installation of MySQL. Run the following command:
sudo apt install mysql-server
During the installation, you will be prompted to set a password for the MySQL root user. Choose a strong password and remember it, as you will need it to access the MySQL server.
After the installation is complete, you can start the MySQL service by running the following command:
sudo service mysql start
To verify that MySQL is running, you can check its status by executing the following command:
sudo service mysql status
If MySQL is running, you will see a message indicating its status as "active (running)."
Congratulations! You have successfully installed MySQL on your Ubuntu system. You can now use the MySQL command-line client or any other MySQL client application to interact with the database server.
Note: It is recommended to secure your MySQL installation by running the MySQL security script. You can do this by executing the following command:
The script will guide you through the process of securing your MySQL installation by configuring options such as removing anonymous users, disallowing remote root login, and removing test databases. It is advisable to follow the prompts and answer the questions to enhance the security of your MySQL server.