{"id":24472,"date":"2024-01-31T15:56:10","date_gmt":"2024-01-31T15:56:10","guid":{"rendered":"https:\/\/linuxways.net\/?p=24472"},"modified":"2024-02-05T04:58:29","modified_gmt":"2024-02-05T04:58:29","slug":"install-mariadb-arch-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/arch\/install-mariadb-arch-linux\/","title":{"rendered":"How to Install MariaDB on Arch Linux"},"content":{"rendered":"<p>To organize, store, and manipulate data there are different tools available, usually known as database tools. The significance of using such tools is that they provide a consistent and reliable way of accessing data, managing data, and ensuring data security, integrity, and quality. They support various data models, such as relational, non-relational, or hybrid, to suit different types of applications and use cases.<\/p>\n<p>They offer various features and tools, such as query languages, indexing, transactions, backup and recovery, replication, and scalability, to optimize data performance and functionality. Usually, using Linux distributions like Arch Linux is a popular way for managing these databases and MariaDB is one of the most used database tools which is based on the relational database management system.<\/p>\n<h2><strong>Contents: <\/strong><\/h2>\n<ul>\n<li><strong>Install MariaDB on Arch Linux<\/strong><\/li>\n<li><strong>Use MariaDB on Arch Linux<\/strong><\/li>\n<li><strong>Remove MariaDB on Arch Linux <\/strong><\/li>\n<\/ul>\n<h2><strong>How To Install MariaDB on Arch Linux<\/strong><\/h2>\n<p>To install MariaDB on Arch Linux there is only one way and that is by using its default package manager though it has a slightly old version. If you are looking for a newer version and using the Debian-based Linux distributions, then you can visit their official website for it. In the case of Arch Linux to install MariaDB execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">pacman <span class=\"re5\">-S<\/span> mariadb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"676\" height=\"503\" class=\"wp-image-24502\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-1.png 676w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-1-300x223.png 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/p>\n<p>Now initialize the MariaDB data directory and create the system tables in the MySQL database and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mariadb-install-db <span class=\"re5\">--user<\/span>=mysql <span class=\"re5\">--basedir<\/span>=<span class=\"sy0\">\/<\/span>usr <span class=\"re5\">--datadir<\/span>=<span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>mysql<\/div><\/div>\n<p>It works by starting the MariaDB server\u2019s mysqld process in &#8211;bootstrap mode and sending commands to create the system tables and their content. The options &#8211;user, &#8211;basedir, and &#8211;datadir specify the username that mysqld will run as, the installation directory, and the data directory, respectively. This command is for Linux\/Unix only. Moreover, this command is also useful for setting up MariaDB on a new system or after upgrading from a previous version.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"498\" class=\"wp-image-24509\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-2.png 672w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-2-300x222.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/p>\n<p>Next, activate the MariaDB service on Arch Linux and for first enable it and then start it using the <em>systemctl <\/em>command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> mariadb<br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> systemctl start mariadb<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"499\" class=\"wp-image-24519\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-3.png 675w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-3-300x222.png 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/strong><\/p>\n<p>The default installation of MariaDB leaves it insecure which can cause security breaches and for that, it is necessary to prevent unauthorized access to your database server and data. So, to configure security settings and improve MySQL or MariaDB server security on Linux systems execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mysql_secure_installation<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"482\" class=\"wp-image-24532\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-4.png 658w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-4-300x220.png 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/p>\n<p>Furthermore, it allows you to set a password for the root user, remove root and anonymous accounts, delete the test database, and reload user privileges tables. Now upon the execution of the command you will receive several prompts:<\/p>\n<p><strong>Switch to unix_socket authentication: <\/strong>If you want to use the unix_socket plugin to authenticate the root user by matching the system username and the MariaDB username. You can avoid passwords and be safer, but only for connections within the same network. The recommended answer is Yes if you only need to access MariaDB as root from the same machine, or No if you need to connect remotely or use a different system username.<\/p>\n<p><strong>Change the root password:<\/strong> If you have not set a password yet, or if you want to use a stronger password, you should answer Yes and enter a new password. Otherwise, you can answer No to keep the existing password.<\/p>\n<p><strong>Remove anonymous users:<\/strong> This prompt asks you if you want to remove the anonymous users that are created by default when you install MariaDB. Anonymous users can pose a security risk, as they can access any database that has not been explicitly protected. The recommended answer is Yes to delete the anonymous users.<\/p>\n<p><strong>Disallow remote login:<\/strong> This prompt asks you if you want to prevent the root user from logging in remotely. Allowing remote login for the root user can expose your MariaDB server to attacks from the network. The recommended answer is Yes to disable remote login for the root user.<\/p>\n<p><strong>Remove test database and access to it: <\/strong>This prompt asks you if you want to remove the test database that is created by default when you install MariaDB. The test database can be accessed by any user, even anonymous users, and can be used to test malicious queries or exploit vulnerabilities. The recommended answer is Yes to delete the test database and the privileges that allow access to it. However, you can enter No if you want to keep the test databases for testing and learning purposes.<\/p>\n<p><strong>Reload table privileges:<\/strong> This prompt asks you if you want to reload the table privileges after making the changes above. This is necessary to apply the new security settings to the MariaDB server. The recommended answer is Yes to reload the table privileges.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"608\" height=\"829\" class=\"wp-image-24548\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-5.png 608w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-5-220x300.png 220w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/p>\n<p>Now once you are done with the changes you can upgrade MariaDB if by any chance the version in the default repository is updated:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mariadb-upgrade<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"165\" class=\"wp-image-24562\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-6.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-6-300x68.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<p>Now login to the MariaDB database tool using the root account, here if you have created any other user then replace the root with its username:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">mysql <span class=\"re5\">-u<\/span> root <span class=\"re5\">-p<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"170\" class=\"wp-image-24572\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-7.png 732w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-7-300x70.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/p>\n<p>Now as you can see in the image above there is a warning for using mysql which says to use mariadb instead as it will be deprecated in the newer versions though still you can use it for logging in:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mariadb <span class=\"re5\">-u<\/span> root <span class=\"re5\">-p<\/span><\/div><\/div>\n<p>Once you are in the database server now you are all set and can create users, and databases and manage them, to list all the databases executed:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SHOW DATABASES;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"495\" class=\"wp-image-24579\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-8.png 675w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-8-300x220.png 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/p>\n<p><strong>Note:<\/strong> As I have mentioned earlier the newer version file for MariaDB is available on its official site but on Arch Linux, there are some issues with the dependencies due to which it cannot be installed. This is because the dependencies required to install the tar.gz file on Arch Linux have been deprecated.<\/p>\n<p>Here I have tried to install through yaourt and other AUR helpers on Arch, but the process wasn\u2019t successful as the repository required for installation of yaourt on Arch is dead as you can see the error in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"676\" height=\"239\" class=\"wp-image-24589\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-9.png 676w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-9-300x106.png 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>How to Use MariaDB on Arch Linux <\/strong><\/h2>\n<p>MariaDB can power websites that need to handle large amounts of content, such as blogs, news portals, e-commerce sites, and more. It can handle log data from different kinds of sources, such as web servers, applications, and devices. MariaDB is free and open source under the GPLv2 license, which means you can use it without any restrictions or fees. Here I have explained some of the basics of using MariaDB:<\/p>\n<h3><strong>1: Creating a Database in MariaDB<\/strong><\/h3>\n<p>The database is primarily a set of data that is specifically about a single entity, for instance, a list of employees and their details of a company or any set of readings regarding any experiment. So, to gather all the data in one place you first have to create a database and execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">CREATE DATABASE <span class=\"sy0\">&lt;<\/span>database-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"511\" class=\"wp-image-24600\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-10.png 680w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-10-300x225.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/p>\n<p>To list all the databases created in MariaDB, just use the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SHOW DATABASES;<\/div><\/div>\n<h3><strong>2: Create a User in MariaDB<\/strong><\/h3>\n<p>Managing a big database by a single user can be a challenging task, so a database can be linked with different users, but these users can be given limited privileges. So, to create a user you need to give a username and password through which the user will access MariaDB:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">CREATE USER <span class=\"st_h\">'&lt;user-name&gt;'<\/span><span class=\"sy0\">@<\/span><span class=\"st_h\">'localhost'<\/span> IDENTIFIED BY <span class=\"st_h\">'&lt;user-passowd&gt;'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"337\" class=\"wp-image-24609\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-11.png 673w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-11-300x150.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/p>\n<p>Once you have created a user, you can log in to MariaDB by giving its username and password as in the syntax below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mariadb <span class=\"re5\">-u<\/span> <span class=\"sy0\">&lt;<\/span>user-name<span class=\"sy0\">&gt;<\/span> -p<span class=\"sy0\">&lt;<\/span>passowrd<span class=\"sy0\">&gt;<\/span> <span class=\"re5\">-h<\/span> localhost<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"653\" height=\"266\" class=\"wp-image-24621\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-12.png 653w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-12-300x122.png 300w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><\/p>\n<p>You can also log in to MariaDB by using the p flag and giving the password at a later stage as this way is more secure because no one can see your database password:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">mariadb <span class=\"re5\">-u<\/span> <span class=\"sy0\">&lt;<\/span>User-name<span class=\"sy0\">&gt;<\/span> <span class=\"re5\">-p<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"277\" class=\"wp-image-24630\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-13.png 656w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-13-300x127.png 300w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/p>\n<p>Just like listing the databases in MariaDB, you can also list the users that have access to MariaDB on Arch Linux and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SELECT User FROM mysql.user;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"679\" height=\"506\" class=\"wp-image-24638\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-14.png 679w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-14-300x224.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/p>\n<h3><strong>3: Grant Privileges in MariaDB<\/strong><\/h3>\n<p>Users in MariaDB require permissions to make changes in the databases so if you want a user to edit or add some data in the database then the respective user should have editing permissions. As in the image below User1 is trying to create a database but it doesn\u2019t have any rights to it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"335\" class=\"wp-image-24647\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-15.png 650w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-15-300x155.png 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>To grant the privileges to a user first, you have to log in using the administrator account and then list all the privileges that can be given to a user along with their command and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SHOW PRIVILEGES;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"625\" class=\"wp-image-24656\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-16.png 938w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-16-300x200.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-16-768x512.png 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/p>\n<p>Now from the privileges table, shortlist the privileges you want to give and then use the <em>GRANT<\/em> command along with the username and database name to give access to the respective user:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON <span class=\"sy0\">&lt;<\/span>database-name<span class=\"sy0\">&gt;<\/span>.<span class=\"sy0\">*<\/span> TO <span class=\"st_h\">'&lt;user-name&gt;'<\/span><span class=\"sy0\">@<\/span><span class=\"st_h\">'localhost'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"369\" class=\"wp-image-24664\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-17.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-17-300x145.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>Now once you have given access to the user for the certain task on the database, log in to MariaDB using that user and execute the below command to see the given privileges:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SHOW GRANTS;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"838\" height=\"625\" class=\"wp-image-24675\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-18.png 838w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-18-300x224.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-18-768x573.png 768w\" sizes=\"auto, (max-width: 838px) 100vw, 838px\" \/><\/p>\n<p>Now as an administrator, you can list the users along with the databases along with their hostname through which they are allowed to access the MariaDB databases:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">SELECT User, Db, Host from mysql.db;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"504\" class=\"wp-image-24682\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-19.png 674w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-19-300x224.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/p>\n<h3><strong>4<\/strong>: <strong>Granting Similar Privileges to Multiple Users <\/strong><\/h3>\n<p>Usually, there might be cases where different databases are accessed by multiple users so in that case it becomes quite a lengthy task to grant each user the same set of rights. For that, it\u2019s better to create a role in MariaDB that has all the privileges that are to be granted to other users and then use the role permissions that can be granted to the users.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">CREATE ROLE <span class=\"sy0\">&lt;<\/span>role-name<span class=\"sy0\">&gt;<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"321\" class=\"wp-image-24688\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-20.png 690w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-20-300x140.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/p>\n<p>Now I have created a role named MANAGER and granted it the same permissions using the <em>GRANT<\/em> command along with the database name:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES,INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON test.<span class=\"sy0\">*<\/span> to <span class=\"st_h\">'MANAGER'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"354\" class=\"wp-image-24693\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-21.png 692w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-21-300x153.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<p>As I have already created a user and to grant it privileges for the test database, I have granted the manager role to User2 by stating its username and password:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">GRANT MANAGER TO <span class=\"st_h\">'&lt;user-name&gt;'<\/span><span class=\"sy0\">@<\/span><span class=\"st_h\">'localhost'<\/span> IDENTIFIED BY <span class=\"st_h\">'&lt;password&gt;'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"405\" class=\"wp-image-24699\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-22.png 694w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-22-300x175.png 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/p>\n<p>Usually, granting all the permissions is not recommended to any of the users except the administrator as it can compromise the security of the database. To give a user or root account full access, run this command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">GRANT ALL PRIVILEGES ON <span class=\"st_h\">'&lt;database-name&gt;'<\/span>.<span class=\"sy0\">*<\/span> TO <span class=\"st_h\">'&lt;user-name&gt;'<\/span><span class=\"sy0\">@<\/span>localhost;<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"679\" height=\"414\" class=\"wp-image-24705\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-23.png 679w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-23-300x183.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/strong><\/p>\n<p>Now if you want to remove all the privileges from a user in case you have assigned a role to the user then in that case execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">REVOKE <span class=\"sy0\">&lt;<\/span>given-role<span class=\"sy0\">&gt;<\/span> FROM <span class=\"sy0\">&lt;<\/span>user-name<span class=\"sy0\">&gt;@<\/span>localhost;<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"286\" class=\"wp-image-24708\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-24.png 674w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-24-300x127.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/strong><\/p>\n<p>Alternatively, you can also revoke the privileges of a user if you have assigned it manually and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">REVOKE ALL PRIVILEGES ON <span class=\"sy0\">*<\/span>.<span class=\"sy0\">*<\/span> FROM <span class=\"st_h\">'&lt;user-name&gt;'<\/span><span class=\"sy0\">@<\/span><span class=\"st_h\">'localhost'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"678\" height=\"406\" class=\"wp-image-24716\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-25.png 678w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-25-300x180.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-25-501x300.png 501w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/p>\n<h3><strong>5: Removing Database in MariaDB<\/strong><\/h3>\n<p>If you want to remove the database in MariaDB then login through the administrator account if the other users do not have permission for it and after that use the below syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">DROP DATABASE <span class=\"sy0\">&lt;<\/span>database-name<span class=\"sy0\">&gt;<\/span>;<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"499\" class=\"wp-image-24721\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-26.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-26.png 675w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-26-300x222.png 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/strong><\/p>\n<h3><strong>6: Removing a User in MariaDB<\/strong><\/h3>\n<p>Further, if you want to delete a user from the MariaDB database on Arch Linux, then execute the drop command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">DROP USER <span class=\"sy0\">&lt;<\/span>user-name<span class=\"sy0\">&gt;@<\/span>localhost;<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"501\" class=\"wp-image-24728\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-27.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-27.png 681w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-27-300x221.png 300w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/strong><\/p>\n<p>Furthermore, if you need more help with commands used for operating MariaDB then you can consult its help:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">help<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"685\" height=\"507\" class=\"wp-image-24736\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-28.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-28.png 685w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-28-300x222.png 300w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/p>\n<p><strong>Note: <\/strong>Granting and revoking access to users for different databases should be done by logging in to the administrator account.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>How to Remove MariaDB from Arch Linux<\/strong><\/h2>\n<p>If you want to completely remove MariaDB from Arch Linux, then first you need to deactivate its service and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl stop mariadb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"677\" height=\"275\" class=\"wp-image-24740\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-29.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-29.png 677w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-29-300x122.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/p>\n<p>Now to uninstall it from Arch using the default package manager along with the <em>Rns<\/em> flag as in the command below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> pacman <span class=\"re5\">-Rns<\/span> mariadb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"679\" height=\"445\" class=\"wp-image-24745\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-30.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-30.png 679w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-30-300x197.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/p>\n<p>Next, remove the directory of MariaDB from Arch Linux and afterward reboot the system to apply the changes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"re5\">-r<\/span> <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>mysql<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"148\" class=\"wp-image-24750\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-31.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-31.png 670w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24472-31-300x66.png 300w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>MariaDB is a database management tool that is open-source and free to use, to install it on Arch Linux use its default package installer. Once you have installed it, make it secure by executing the <em>sudo mysql_secure_installation<\/em> command. Compared to MySQL, MariaDB offers more features and capabilities, which makes it a preferred choice for most users.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install it on Arch Linux, use its default package manager. Once you have installed it, make it secure by executing the sudo mysql_secure_installation command.<\/p>","protected":false},"author":113,"featured_media":24784,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1055],"tags":[],"class_list":["post-24472","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arch"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/24472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=24472"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/24472\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/24784"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=24472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=24472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=24472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}