Add a new user to mysql and give privileges

Use the below command to add the user ‘theG’ to the mysql server and give full privileges.

1. Adding user theG :

CREATE USER ‘theG’@’hostname’ IDENTIFIED BY ‘password’;

Note : change the hostname to localhost for the same machine.

2. Give full access :

GRANT ALL PRIVILEGES ON * . * TO ‘theG’@’hostname’;

ps : If you want to change the password for the user :

SET PASSWORD FOR ‘theG’@’localhost’ = PASSWORD(‘mypassword’);

 

Note : Give privileges to a particular database :

GRANT ALL PRIVILEGES ON database_name.* TO ‘user’@’hostname’;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s