Installation and security of the MariaDB database server on Ubuntu 22.04
The following guide describes how to install the MariaDB database server on Ubuntu 22.04
We will do the whole thing in a few minutes using the console
We start the terminal and issue commands:
We update packages and our system:
1 | sudo apt-get update && sudo apt-get upgrade -y |
The next step is to install the necessary packages:
1 | sudo apt-get install software-properties-common dirmngr gnupg2 -y |
1 | sudo apt-get install apt-transport-https wget curl -y |
We install the MariaDB server
1 | sudo apt-get install mariadb-server -y |
We add the service to the autostart:
1 | sudo systemctl enable mariadb |
We make the initial security
In the console, issue the command:
1 | sudo mysql_secure_installation |
And we answer the questions as in the screenshot:
Log in to mysqla by issuing a command:
1 | mysql -u root -p |
Create an administrative user, which uses password authentication:
We log in to MariaDB
sudo mariadb
Then create a new user with root privileges and password-based access. remember, to change the username and password according to your preferences:
1 | GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'hasło' WITH GRANT OPTION; |
We are overcharging the permissions:
1 | FLUSH PRIVILEGES; |
We are exiting the database console:
1 | exit |