The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Install a MySQL database with these few steps

posted on 26.6.2023 by Below Surface in "MySQL"

Update the system and install MySQL server:

sudo apt update
sudo apt install mysql-server

Start the service:

sudo service mysql start
// if this does not work, run:
sudo systemctl start mysql

Secure the installation:

sudo mysql_secure_installation

If you occur this error:

... Failed! Error: SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.

Then: Close the process and run

sudo mysql

Provide a password (usually it should have at least 8 characters, a combination of upper- and lowercase letters, numbers and special characters):

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

Desired output:

Query OK, 0 rows affected (0.01 sec) 


mysql database