Install MariaDB on Arch Linux
Install MariaDB on Arch Linux
Section I:
Install and config MariaDB
1. Install MariaDB
pacman -S mariadb
2. Configure MariaDB:
mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql
3. Run MariaDB and make it run every boot
systemctl enable –now mariadb
4. Complete recommended security measures
mysql_secure_installation
5. Test Connection
mysql -u root -p
Section II:
Add a user to MariaDB
1. Have Access to the MariaDB client shell:
sudo mysql -u root
(Add -p if your have a password)
2. Create a new database
CREATE DATABASE DB_NAME;
3. Create new MariaDB User
CREATE USER ‘new_user_name‘@localhost IDENTIFIED BY ‘new_password’;
4. Check the status of it
SELECT User FROM mysql.user;
5. To grant all privileges to new user
GRANT ALL PRIVILEGES ON . TO ‘new_user_name‘@localhost IDENTIFIED BY ‘new_password’;
6. To grant privileges only for DB_NAME
GRANT ALL PRIVILEGES ON ‘DB_NAME’.* ‘new_user_name‘@localhost;
7. Check the result
SHOW GRANTS FOR ‘new_user_name‘@localhost;
8. Remove the user account
DROP USER ‘new_user_name‘@localhost;