Contents
Install MySQL on Ubuntu 20.04
To install MySQL on Ubuntu 20.04, you can follow these steps:
Open a Terminal:
Press Ctrl + Alt + T to open a terminal window.
Update Package Lists:
It's a good practice to start by updating the package lists to ensure you have the latest information about available packages:
sudo apt update
Install MySQL Server:
You can install the MySQL server by running the following command:
sudo apt install mysql-server
During the installation process, you'll be prompted to set a password for the MySQL root user. This is an important step, so make sure to choose a strong password.
Start and Enable MySQL Service:
After the installation is complete, start the MySQL service and enable it to start on boot:
sudo systemctl start mysql
sudo systemctl enable mysql
This will ensure that MySQL starts automatically when the system boots up.
Secure MySQL Installation (Optional):
MySQL includes a script that can help you secure the installation further. You can run it with:
sudo mysql_secure_installation
This script will guide you through various security options, including setting a root password, removing anonymous users, disallowing remote root login, and removing test databases.
Verify Installation:
You can verify that MySQL is running by checking its status:
sudo systemctl status mysql
You should see an output indicating that the service is active and running.
Access MySQL:
You can access the MySQL prompt with the following command:
sudo mysql
This will open the MySQL shell where you can start interacting with the database.
Sorry! No comment found:(
There is no comment to show for this.