Pages

Sunday, August 7, 2011

MySQL Basics - Creating User Account

I'm learning MySQL, so I'll be sharing some basic MySQL commands I'm learning. I had to start somewhere, so the basics it is.

Here's one basic thing I learned today:

Creating a Database User:

CREATE USER 'username' @ 'localhost' IDENTIFIED BY 'password';

In this case we create a user called username with a password called password on our database located on the computer (localhost).

Now we need to give the user access to our database(s):


GRANT ALL *.* TO 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL = Gives all permissions to the user we just created above (read, write, delete!!) on localhost
First * = All Databases, the user has access to all databases
Second * = All tables, the user has access to all tables

Always remember to end a command line with a semi-colon! ;

1 comment:

  1. Being the "non-techy" type person I actually got this post. nice!

    ReplyDelete