Ca va ENCORE parler de bits!

2014-02-27  |  Tips 'n' Tricks  |  mysql right server software user

Few lines to create a new database and a new user with full access on it. The advantage of this method is to do not give access to another databse to this user.

 

Connect yourself to the local database server as user root (you will be prompted for a password).

mysql -h localhost -u root -p

 

Now we see the 'mysql>' prompt and we can run the following to create a new database for Paul.

mysql> create database pauldb;
Query OK, 1 row affected (0.00 sec)

 

Now we create the user paul and give him full permissions on the new database. If the user allready exist, that only set this user as owner with selected right.

mysql> grant CREATE,INSERT,DELETE,UPDATE,SELECT on pauldb.* to paul@localhost;
Query OK, 0 rows affected (0.00 sec)

 

Next we set a password for this new user. If the user already exist, do not reset his password.

mysql> set password for paul = password('mysecretpassword');
Query OK, 0 rows affected (0.00 sec)

 

Cleanup and exit.

mysql> flush privileges; 
mysql> exit;

Share this article :

blog comments powered by Disqus

© 2012-2017 Ca va ENCORE parler de bits! All Rights Reserved.