How to create a Database and give privileges ?

To create a database use the command :-

 

CREATE DATABSE polls;

 

To create user use the command:-

 

create user ‘username’ identified by ‘password’;

 

To grant privilages use the command :-

 

grant all on ‘database’.* to ‘username’@’%’;

 

flush privileges;

 

For example use this command when a error occurs in django :-

 

the error like :-

 

super(Connection, self).__init__(*args, **kwargs2)

_mysql_exceptions.OperationalError: (1045, “Access denied for user ‘joe’@’localhost’ (using password: YES)”)

 

command to be used

 

GRANT ALL ON django_db.* TO ‘joe’@’localhost’IDENTIFIED BY ‘manuelian’;