User creation in Mysql where dbname consist hyphen

We can create a user that consists of no special character at ease.

mysql>  create user ‘abc’@’localhost’ identified by ‘redhat’;

But to create a user for a database which consists of special character we follow this:-

mysql> grant all privileges on `Emp-Kolkata`.* to soumya@’localhost’ identified by ‘redhat’;

mysql> grant all privileges on `Emp-Kolkata`.* to soumya@’%’ identified by ‘redhat’;

mysql> flush privileges;

So the above command shows how to create a user for a dbname that consists hyphen in it and we granted all privileges to that user for both localhost and remote location.


Categories

Leave a Reply

Your email address will not be published. Required fields are marked *