Thursday, March 14, 2019

MariaDB

Setup

  1. Installation
    • sudo dnf install mariadb mariadb-server 
  2. Make MariaDB run on startup
    • sudo systemctl enable mariadb
  3. Start MariaDB
    • sudo systemctl start mariadb
  4. Begin configuring:
    • sudo mysql_secure_installation
  5. When prompted for password:
    • press enter
  6. Set root password?
    • enter y
  7. Enter db root password twice
  8. Remove anonymous users?
    • enter y
  9. Disallow root login remotely?
    • enter y
  10. Remove test database and access to it?
    • enter y
  11. Reload privileges table now?
    • enter y

Use Prompt

mysql -u root -p

Commands

  • Create Database
    • mysql> CREATE DATABASE `mydb`;
  • Delete Database
    • DROP DATABASE mydb;
  • User
    1. Initial creation
      • mariadb> CREATE USER 'myuser' IDENTIFIED BY 'mypassword';
    2.  Allow user to use database server
      • mariadb> GRANT USAGE ON *.* TO 'myuser'@localhost IDENTIFIED BY 'mypassword';
    3.  Grant user privileges to database
      • mariadb> GRANT ALL privileges ON `mydb`.* TO 'myuser'@localhost;
    4. Apply changes
      • mariadb> FLUSH PRIVILEGES;
    5. Verify changes
      • mariadb> SHOW GRANTS FOR 'myuser'@localhost;
  • Delete User
    • DROP USER myuser@localhost;

No comments:

Post a Comment