Wednesday, May 7, 2008

Mysql create user, database & access

I broken my head to create user and give access permission to the particular database.

Finally i got the problem that "Version problem".

I am using "mysql Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i686)"

If you face this problem then, this post will help you reduce your time.

Commands:
1) CREATE DATABASE {DATABASE NAME};
2) GRANT ALL PRIVILEGES ON {DATABASE_NAME}.* TO '{USER NAME}'@'host' IDENTIFIED BY 'password';
3) use mysql;
4) update user set select_priv = 'Y',update_priv = 'Y',create_priv = 'Y', delete_priv = 'Y' where user = 'USER_NAME';



Explanation:
1) CREATE DATABASE ;
Create database.
2) GRANT ALL PRIVILEGES ON DATABASE_NAME.* TO ''@'host' IDENTIFIED BY 'password';
We haven't created user but granting permission to the user. This will create a user with name {USER_NAME} in the "user" table of "mysql" database.
3) use mysql;
Login to mysql table to update the table level permission.
4) update user set select_priv = 'Y',update_priv = 'Y',create_priv = 'Y', delete_priv = 'Y' where user = 'USER_NAME';
This will update the basic manipulation permission to the user.

0 comments:

Post a Comment