1.yum install mariadb-server mariadb
2.systemctl enable mariadb; systemctl start mariadb
3.mysql_secure_installation
4.mysql -u root -p mysql -e "SELECT User,Host FROM user"
5.mysql -u root -p
6.CREATE DATABASE db1 CHARACTER SET utf8 COLLATE utf8_general_ci;
7.SHOW DATABASES;
8.GRANT ALL ON db1.* to 'user1'@'localhost' IDENTIFIED BY 'redhat' WITH GRANT OPTION;
9.FLUSH PRIVILEGES;
10.EXIT
11.mysql -u user1 -p
12.SHOW DATABASES;
note:
1. DROP DATABASE IF EXISTS db2;
2. GRANT ALL ON *.* TO 'user2'@'localhost' IDENTIFIED BY 'redhat' WITH GRANT OPTION;
3. SELECT HOST,USER FROM mysql.user WHERE USER='user1';
4. SHOW GRANTS FOR 'user2'@'localhost';
5. DROP USER 'user3'@'localhost';
6. Allowing remote access to a MariaDB server:
1. firewall-cmd --permanent --add-service=mysql && firewall-cmd --reload
2. GRANT SELECT ON mysql.user TO 'joh'@'192.168.1.2' IDENTIFIED BY 'openbsd';
3. FLUSH PRIVILEGES; EXIT;
4. mysql -u joh -p -h 192.168.1.1 mysql