Create a new MariaDB database and user

Moderator: frogmaker

frogmaker
Moderator
Moderator
Posty: 55
Rejestracja: 06 maja 2018, 12:57

Create a new MariaDB database and user

Post autor: frogmaker »

Log in to the database server using the MariaDB client and the correct credentials. Then, follow the steps below to create a new database and user for your applications:

Create a new database:

MariaDB> create database DATABASE_NAME;

Create a new user (only with local access) and grant privileges to this user on the new database:

MariaDB> grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'localhost' identified by 'PASSWORD';

Create a new user (with remote access) and grant privileges to this user on the new database:

MariaDB> grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'%' identified by 'PASSWORD';

After modifying the MariaDB grant tables, execute the following command in order to apply the changes:

MariaDB> flush privileges;

Some applications require specific privileges in the database. Check the MariaDB official documentation for getting, installing, and upgrading MariaDB.
frogmaker
Moderator
Moderator
Posty: 55
Rejestracja: 06 maja 2018, 12:57

Re: Create a new MariaDB database and user

Post autor: frogmaker »

SELECT User FROM mysql.user;

SET PASSWORD FOR 'techonthenet'@'localhost' = PASSWORD('newpassword');
ODPOWIEDZ