Adding either user or ip to mysql database

Unix

17 Dec 2015

Adding either user or ip to mysql database

Preston Garrison 0 Comments

If you need to add either a new user, or update an existing one the command is rather simple:

 

GRANT ALL PRIVILEGES ON *.* TO 'user'@'8.8.8.%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

 

This would add anything in the 8.8.8.* netblock, with the user named “user” and the password “password”

You could wildcard to make it any ip with just a %, or you could specify an exact ip.   YOU MUST specify password every time, even if you are only adding an ip.

 

Preston Garrison