How to install mysql in ubuntu?

Member

by gaston , in category: Installation & Upgrades , 2 years ago

How to install mysql in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by noemy.bosco , a year ago

@gaston 

To install MySQL on Ubuntu, follow these steps:

  1. Update the package manager's cache by running the following command:
1
sudo apt update


  1. Install the MySQL server package by running the following command:
1
sudo apt install mysql-server


  1. During the installation process, you will be prompted to set a password for the MySQL root user. Enter a strong password and remember it, as you will need it later to configure and manage the MySQL server.
  2. Once the installation is complete, start the MySQL service by running the following command:
1
sudo systemctl start mysql


  1. To verify that the MySQL service is running, use the following command:
1
sudo systemctl status mysql


  1. To secure the MySQL installation, run the mysql_secure_installation script:
1
sudo mysql_secure_installation


This script will prompt you to set a new password for the root user, remove anonymous users, disable root login remotely, and remove the test database. Follow the prompts to complete the configuration.


That's it! MySQL is now installed and configured on your Ubuntu system. You can use the mysql command-line client to connect to the MySQL server and start working with it.