Mysql Permissions — Quickly

Sometimes you gotta grant Mysql permissions for usernames… so here’s how I do it.

$ mysql -u root -p

Enter password: [password] [ENTER]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14806 to server version: 4.1.11

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> insert into db values (’IP or Hostname‘, ‘DB Name‘, ‘Username‘, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘N’, ‘Y’, ‘Y’, ‘Y’);

mysql> insert into user values (’IP or hostname‘, ‘Username‘, ‘xxx’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’);

the XXX is where the password will exist.

mysql> update user set Password=password(’Password‘) where user=’Username‘;

Leave a Comment