Tutorial Install MariaDb on Linux Debian OS



Hi, today I will demonstrate how to install mariadb on Linux Debian OS.

In this case, I use Debian on Virtual Box;

Follow these steps bellow.

First, make sure you have installed Debian on Virtual Box.

$ sudo apt update

$ sudo apt install mariadb-server

$ sudo mysql_secure_installation


Change port and access MariaDb from IP address :

$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add this line :

[mysqld]

port=6001

bind-address = 0.0.0.0

If you done, press keyboard Ctrl + x, then type: y , then press (enter).


Restart MariaDb :

$ sudo systemctl restart mariadb


Change root password on MariaDb :

$ su root (enter)

$ mariadb (enter)

$ use mysql; (enter)

$ desc user; (enter)

$ select Host, User, Password, authentication_string, password_expired from user;

$ GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY 'Jakarta098' WITH GRANT OPTION;

$ FLUSH PRIVILEGES;

$ GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'Jakarta098' WITH GRANT OPTION;

$ FLUSH PRIVILEGES;

$ GRANT ALL ON *.* TO 'mysql'@'localhost' IDENTIFIED BY 'Jakarta098' WITH GRANT OPTION;

$ FLUSH PRIVILEGES;

$ GRANT ALL ON *.* TO 'mariadb.sys'@'localhost' IDENTIFIED BY 'Jakarta098' WITH GRANT OPTION;

$ FLUSH PRIVILEGES;

$ exit


Restart MariaDb :

$ systemctl restart mariadb


Test login from cmd / terminal :

$ mariadb --host=127.0.0.1 --port=6001 --user=root --password

$ (enter root password)


Done.



Source :

https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-debian-11

https://git-maspaad.blogspot.com/2022/08/mariadb-or-mysql-query-remove-root.html

https://git-maspaad.blogspot.com/2022/01/mysql-connect-from-terminal-or-cmd.html

Comments