How to install MySQL on Linux?

You can follow these steps to install MySQL on Linux:

  1. Open the terminal and log in to the system as the root user.
  2. Run the following command to update the package list:
  3. Update the system using sudo apt
  4. Run the following command to install the MySQL server:
  5. Please install mysql-server using the command ‘sudo apt install mysql-server’.
  6. During the installation process, the system will prompt you to enter the root password for the MySQL server. Please follow the instructions to input and confirm the password.
  7. After the installation is completed, you can run the following command to start the MySQL service:
  8. Commence the MySQL service using sudo systemctl.
  9. You can use the following command to check if the MySQL service is running:
  10. Show me the current status of the MySQL service using systemd.
  11. Run the following command to set up MySQL service to start automatically when the system boots up:
  12. Enable MySQL service using systemctl.
  13. To use MySQL, you can log in to the MySQL server by running the following command:
  14. Type “sudo mysql -u root -p” in the command line.
  15. The system will prompt you to enter the root password for the MySQL server. After entering the password, press Enter to log in to the MySQL server.

Now, you have successfully installed and logged into the MySQL server. You can use the MySQL command line tool or other client tools to manage and operate the MySQL database.

bannerAds