Tuesday, July 26, 2011

How to create database and "grant all" perm for an user

   We can create Database in two way, one is using mysqladmin  and other is using mysql prompt.

Method 1: Using mysqladmin

root@debian:# mysqladmin -u root -v create gnu

Method 2 : Using mysqlprompt

root@debian:/home/mughil# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 112
Server version: 5.1.49-3 (Debian)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database foss;
Query OK, 1 row affected (0.02 sec)

After creating db, we have to assign grant perm to  user on the db.

mysql> grant all on foss.* to mughil@localhost identified by 'mughil';
Query OK, 0 rows affected (0.00 sec)


No comments:

Post a Comment