Installing Maria DB on Ubuntu 22
In this manual I will show you how install mariaDB on Ubuntu 22.
Article update date: 11-Decembre-2023
Update apt.
sudo apt update
Install packeges
Execute the below-given command to install packages essential for MariaDB installation
sudo apt-get install wget software-properties-common dirmngr ca-certificates apt-transport-https -y
Install maria DB Client and server
sudo apt install mariadb-server mariadb-client
Checking Maria DB version
mariadb --version
Checking maria DB status
systemctl status mariadb
Configure recurity
In this step, we will install the security script with the MariaDB installation to protect our database from hacker and any kind of intrusion.
sudo mysql_secure_installation
You will be then asked to configure the following settings:
Root password. Type root password.
Switch to unix_socket authentication? type "n".
Change the root password? Type "n".
Remove anonymous user? Type "Y"
Reload privilege table now? Type "Y"
Write out the provided command in terminal for logging in to MariaDB account:
sudo mariadb
Before moving ahead firstly, it is required to flush all privileges:
> flush privileges;
Create a web user for login
For create a new user type this comand changing user and pasword.
CREATE USER 'webuser'@'localhost' IDENTIFIED BY 'yourpassword';
Give privileges to new user
Then grant all privileges to the created MariaDB “webuser” user:
GRANT ALL PRIVILEGES ON *.* to 'webuser'@'localhost';
Connect using console to mariaDB.
mariadb -u webuser -p
You can create new databases with this user.
Enabling remote acces.
Open the MariaDB configuration file in a text editor:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Look for the bind-address directive and change its value to 0.0.0.0. This allows MariaDB to listen on all available interfaces:
bind-address = 0.0.0.0
Save the file and exit the text editor.
Restart the MariaDB service to apply the changes:
bind-address = 0.0.0.0
sudo systemctl restart mariadb
Comments
Post a Comment