How do I create a MySQL database and set privileges to a user? Imprimir

  • 130

We will explain to you how to grant a user full access to a selected database via the SSH terminal.
Make sure you have the 'root' mysql password available to authenticate:

Enter the mysql CLI with following command and enter the mysql root password:

$ mysql -u root -p
Enter password:


We can now create a user 'testUser' with password 'Temporary123' and grant him access to the 'testDB' database:

mysql> grant all privileges on testDB.* to 'testUser@localhost' identified by 'Temporary123';
Query OK, 0 rows affected (0.00 sec)


Make sure to flush the privileges of the changed configuration:

mysql> flush privileges;



That's it!


¿Fue útil la respuesta?

« Atrás