-->
  • Recent Articles

    How to Create New user and Give access to it in mariaDB/MySQL?

    How to Create New user and Give access to it in mariaDB/MySQL?



    1. Go to MySQL Prompt.

    mysql -u root -p

    2. At MySQL Prompt choose the DB and create the User.

    MariaDB [(none)]> use mysql;
    MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';

    3. Now give Privileges to the user. I've Given all privileges to the User.

    MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';

    To give any specific user with a permission you use following pattern.

     GRANT [type of PRIVILEGES] ON [DB name].[table name] TO '[username]'@'localhost’;

    4. Now Flush Privilages to get the Privilages effected.

    MariaDB [(none)]> FLUSH PRIVILEGES;

    No comments