To install MySQL server on Ubuntu 22.04 LTS Linux, you can use the package manager apt
.
First, make sure the package database is up to date by running:
sudo apt update
Then install the MySQL server package:
sudo apt install mysql-server
During the installation process, you will be prompted to set a root password for the MySQL server. Make sure to choose a secure password and remember it for future use.
Once the installation is complete, you can start the MySQL service with:
sudo systemctl start mysql
You can also enable the MySQL service to start automatically at boot time:
sudo systemctl enable mysql
You can check the status of the MySQL service with:
sudo systemctl status mysql
You can also use the command mysql_secure_installation
to secure the installation of MySQL, change the root password, remove anonymous users, disallow root login remotely and more.
To access the MySQL shell, use the following command:
mysql -u root -p
You will be prompted to enter the root password that you set earlier.
After that you can start creating your databases, tables, users and etc.
Please note that this is just a basic process of installing MySQL, you should consider security and performance configurations after installation.