Mysql / Mariadb Command Refarences


  1. Check Database:
      • show databases;
  2. Check User
      • select User FROM mysql.user;
  3. Check Grant
      • SHOW GRANTS FOR 'myuser';
  4. Check Grant with details
      • HOW GRANTS FOR 'myuser'@'localhost';
      • SHOW GRANTS FOR 'myuser'@'127.0.0.1';
  5. Bind Address 
      • MySQL:
        • /etc/mysql/mysql.conf.d/mysql.cnf
      • Mariadb
        •  /etc/mysql/mariadb.conf.d/50-server.cnf
  • Grand all privileges to a user account over a specific database:
    • GRANT ALL PRIVILEGES ON mydatabase.* TO 'my_user'@'localhost';
  • Grand all privileges to a user account over all databases:
    • GRANT ALL PRIVILEGES ON *.* TO 'my_user'@'localhost';
  • Grand all privileges to a user account over a specific table from a database:
    • GRANT ALL PRIVILEGES ON my_name.table_name TO 'my_user'@'localhost';
  • Grant multiple privileges to a user account over a specific database:
    • GRANT SELECT, INSERT, DELETE ON mydb_name.* TO my_user@'localhost';
Create User and their permissons:
  • CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'redhat';
  • GRANT ALL PRIVILEGES ON * . * TO 'myuser'@'localhost';



Comments