9951 explained code solutions for 126 technologies


mariadbHow to add user to Mariadb?


Adding a user to MariaDB is a simple process.

  1. Log in to the MariaDB server as the root user:
mysql -u root -p
  1. Create a new user with the CREATE USER command:
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
  1. Grant the user privileges with the GRANT command:
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
  1. Flush the privileges to make sure the changes take effect:
FLUSH PRIVILEGES;
  1. Exit the MariaDB shell:
EXIT;

The new user is now ready to use.

Helpful links

Edit this code on GitHub