• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How To Install And Configure MariaDB on Debian 11.3

  • 00:44 apt install mariadb-server
  • 01:02 systemctl status mariadb
  • 01:12 systemctl enable mariadb
  • 01:34 mysql_secure_installation
  • 02:09 mysql -u root -p
7565

To Install and Configure Mariadb on Debian 11.3

Introduction:

MariaDB is an open-source, fully compatible relational database management system (RDBMS) that makes adding new users and granting them privileges easy. Controlling access and permissions is a common task when managing a database.

Installation Procedure :

Step 1: Install the Mariadb-server by using the below command

root@debian:~# apt install mariadb-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dbconfig-common dbconfig-mysql default-mysql-client icc-profiles-free libjs-bootstrap4 libjs-codemirror
  libjs-jquery libjs-jquery-mousewheel libjs-jquery-timepicker libjs-jquery-ui libjs-openlayers libjs-popper.js
  libjs-sizzle libjs-sphinxdoc libjs-underscore libonig5 libzip4 node-jquery
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  mariadb-server
0 upgraded, 1 newly installed, 0 to remove and 208 not upgraded.
Need to get 35.5 kB of archives.
After this operation, 73.7 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 mariadb-server all 1:10.5.19-0+deb11u2 [35.5 kB]
Fetched 35.5 kB in 0s (255 kB/s)
Selecting previously unselected package mariadb-server.
(Reading database ... 142102 files and directories currently installed.)
Preparing to unpack .../mariadb-server_1%3a10.5.19-0+deb11u2_all.deb ...
Unpacking mariadb-server (1:10.5.19-0+deb11u2) ...
Setting up mariadb-server (1:10.5.19-0+deb11u2) ...

Step 2: Check the MariaDB status by using the below command

root@debian:~# systemctl status mariadb
● mariadb.service - MariaDB 10.5.19 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-06-16 12:35:49 CDT; 1 weeks 0 days ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 607 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 8 (limit: 4623)



     Memory: 109.0M
        CPU: 1.903s
     CGroup: /system.slice/mariadb.service
             └─607 /usr/sbin/mariadbd

Jun 16 12:35:49 debian mariadbd[607]: Version: '10.5.19-MariaDB-0+deb11u2'  socket: '/run/mysqld/mysqld.sock'  po>
Jun 16 12:35:49 debian systemd[1]: Started MariaDB 10.5.19 database server.
Jun 16 12:35:49 debian /etc/mysql/debian-start[694]: Upgrading MySQL tables if necessary.
Jun 16 12:35:50 debian /etc/mysql/debian-start[698]: Looking for 'mariadb' as: /usr/bin/mariadb
Jun 16 12:35:50 debian /etc/mysql/debian-start[698]: Looking for 'mariadb-check' as: /usr/bin/mariadb-check
Jun 16 12:35:50 debian /etc/mysql/debian-start[698]: This installation of MariaDB is already upgraded to 10.5.19->
Jun 16 12:35:50 debian /etc/mysql/debian-start[698]: There is no need to run mysql_upgrade again for 10.5.19-Mari>
Jun 16 12:35:50 debian /etc/mysql/debian-start[698]: You can use --force if you still want to run mysql_upgrade
Jun 16 12:35:50 debian /etc/mysql/debian-start[714]: Checking for insecure root accounts.
Jun 16 12:35:50 debian /etc/mysql/debian-start[722]: Triggering myisam-recover for all MyISAM tables and aria-rec>

Step 3: Enable the MariaDB by using the below command

root@debian:~# systemctl enable mariadb
Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb

Step 4: Install the MySQL secure installation and set the root passwd by using the below command

root@debian:~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!





In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.




Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Step 5: Open the MariaDB Database by using the below command

root@debian:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 6: Create a new database by using the below command

MariaDB [(none)]> CREATE DATABASE MYSQL;
Query OK, 1 row affected (0.001 sec)

Step 7: Use the create database

MariaDB [(none)]> USE MYSQL;
Database changed

Step 8: Check the number of available databases

MariaDB [MYSQL]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| MYSQL              |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.001 sec)

Step 9: Create new user in database by using the below command

MariaDB [MYSQL]> CREATE USER 'USER1'@'localhost' IDENTIFIED BY'mysql@123';
Query OK, 0 rows affected (0.009 sec)

Step 10: Refresh the privileges by using the below command

MariaDB [MYSQL]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

Step 11: Grant the privileges to MariaDB user by using the below command

MariaDB [MYSQL]> GRANT ALL ON *.*TO'USER1'@'localhost'WITH GRANT OPTION;
Query OK, 0 rows affected (0.002 sec)

Step 12: Refresh the privileges by using the below command

MariaDB [MYSQL]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

Step 13: Grant the multiple privileges to MariaDB user by using the below command

MariaDB [MYSQL]> GRANT INSERT,UPDATE ON *.*TO'USER1'@'localhost';
Query OK, 0 rows affected (0.002 sec)

Step 14: Show the user Grant the privileges by using the below command

MariaDB [MYSQL]> SHOW GRANTS FOR 'USER1'@'localhost';
+-----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for USER1@localhost                                                                                                              |
+-----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `USER1`@`localhost` IDENTIFIED BY PASSWORD '*4B4F5AF88255C46EB9281BD84ED0329C56937097' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

Step 15: Remove the MariaDB user account by using the below command

MariaDB [MYSQL]> DROP USER'USER1'@'localhost';
Query OK, 0 rows affected (0.002 sec)

Step 16: exit the MariaDB by using the below command

MariaDB [MYSQL]> exit;
Bye

Conclusion:

By this how to install and configure MariaDB has come to an end.

Tags:
stephan
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to create a database in MariaDB?

A

CREATE DATABASE Database_name;

Q

How to use MariaDB?

A

USE database_name;

Q

How to add users to the MariaDB database?

A

CREATE USER 'USER1'@'localhost' IDENTIFIED BY'mysql@123';

Q

How to grant different user permission?

A

GRANT ALL ON *.*TO'USER1'@'localhost'WITH GRANT OPTION;

Q

How to remove the user in MariaDB?

A

DROP database name 'username'@localhost';

Related Tutorials in How To Install And Configure MariaDB on Debian 11.3

Related Tutorials in How To Install And Configure MariaDB on Debian 11.3

How to install Gparted on Debian 9.0
How to install Gparted on Debian 9.0
Sep 13, 2017
How to Completely Delete MariaDB Server 10.3v on Ubuntu 19.04
How to Completely Delete MariaDB Server 10.3v on Ubuntu 19.04
Jun 11, 2019
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Sep 19, 2018
How to install Xrdp Server (Remote Desktop) on Oracle Linux 8.5
How to install Xrdp Server (Remote Desktop) on Oracle Linux 8.5
Oct 17, 2022
How to check database and table size in MariaDB
How to check database and table size in MariaDB
Feb 10, 2017
How to install and update OpenSSL on Debian 11.3
How to install and update OpenSSL on Debian 11.3
Oct 21, 2022
How to install qBittorrent on Debian 9.0
How to install qBittorrent on Debian 9.0
Sep 8, 2017
How to Install FileZilla in Debian
How to Install FileZilla in Debian
Nov 29, 2016

Related Forums in How To Install And Configure MariaDB on Debian 11.3

Related Forums in How To Install And Configure MariaDB on Debian 11.3

Linux
jayce class=
shasum command not found
May 5, 2017
Linux
stephan class=
How to list all samba users
Jan 12, 2018
pv command
muhammad class=
pvcreate command not found error
May 9, 2017
Linux
henry class=
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
Apr 25, 2017
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Linux
baseer class=
single command to apply setfacl for multiple user at a time
Jan 23, 2018
Linux
beulah class=
What does mean by 0 0 value in fstab file
Jan 2, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018

Related News in How To Install And Configure MariaDB on Debian 11.3

Related News in How To Install And Configure MariaDB on Debian 11.3

Anbox, the Android-to-Linux tool the developers have been waiting for
Anbox, the Android-to-Linux tool the developers have been waiting for
Apr 17, 2017
Linus Torvalds stops signing Linux kernel RC tarballs
Linus Torvalds stops signing Linux kernel RC tarballs
May 17, 2017
Capsule8 Launches Linux-Based Container Security Platform
Capsule8 Launches Linux-Based Container Security Platform
Feb 14, 2017
Symantec updates Management console product
Symantec updates Management console product
Nov 22, 2017
Latest Linux driver release feature seven AMD Vega
Latest Linux driver release feature seven AMD Vega
Mar 23, 2017
A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
Apr 9, 2019
Microsoft makes its Azure App service now available on Linux Systems
Microsoft makes its Azure App service now available on Linux Systems
Sep 7, 2017
Docker friendly Alpine Linux gets hardened Node.js
Docker friendly Alpine Linux gets hardened Node.js
Apr 19, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaac ?
How to run windows application in linux

I need to run the windows application in my Linux machine, instead of installing from yum repo or any other repos. How to do that..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.