How to install and use MySQL in Ubuntu?

The steps to install MySQL on Ubuntu are as follows:

  1. Open the terminal and type the following command to update the list of software packages:
sudo apt update
  1. Install the MySQL server.
sudo apt install mysql-server
  1. During the installation process, the system will prompt you to set a password for the MySQL root user. Set the password and confirm.
  2. After installation is complete, you can use the following command to start the MySQL service:
sudo systemctl start mysql
  1. You can use the following command to check the running status of the MySQL service:
sudo systemctl status mysql
  1. To automatically start the MySQL service when the system boots up, you can use the following command:
sudo systemctl enable mysql
  1. Login to the MySQL server using the following command:
mysql -u root -p
  1. You can log in to the MySQL server by entering the password that has been set.
  2. Once logged in, you can start using the MySQL database. You can perform operations such as creating databases, creating tables, and inserting data.
  3. To exit the MySQL server, you can use the following command:
exit;

This way, you can install and use the MySQL database on your Ubuntu system.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds