MySQL

Install

My enviroment:

  • Architecture: x86_64

  • OS: Ubuntu 22.04 LTS

Update packages then install mysql:

sudo apt update
sudo apt upgrade
sudo apt install mysql-server

Test if it works and check version:

sudo systemctl enable mysql
sudo systemctl start mysql
sudo systemctl status mysql
mysql -V

Security

Enhance your database security by running mysql_secure_installation script:

sudo mysql_secure_installation

choose the options:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Then you can login to mysql as root with password:

mysql -u root -p

Last updated