MariaDB

From AlphaBook
Revision as of 13:33, 14 March 2019 by Admin (talk | contribs) (Install)
Jump to: navigation, search

Install

  • yum info mariadb-server
  • yum install mariadb-server -y
  • mysql_secure_installation

Configure Service

  • systemctl start mariadb
  • systemctl enable mariadb
  • systemctl status mariadb

Configure Firewall (TCP 3306)

  • firewall-cmd --permanent --add-service mysql
  • firewall-cmd --list-service

Database Operation

  • mysql -u root -p
  • show databases;
  • create database Test;
  • drop database Test;
  • create database myDB;
  • grant all privileges on myDB.* to myDBower@'%' identified by '123.com';
  • grant select on myDB.* to myDBread@'%' identified by '123.com';
  • flush privileges;

Backup and Restore

  • mysqldump -uroot -p123.com myDB | gzip >> /backup/myDB.sql.gz
  • gunzip /backup/myDB.sql.gz
  • cat /backup/myDB.sql | mysql -uroot -p123.com myDB