Creating a New DB / User

Creating a New DB / User

am 13.05.2009 17:05:02 von Carlos Williams

I have used MySQL twice in my career so I did read the MySQL How-to
page and just wanted to ask here if what I did as correct based on
what I wanted to do. I just wanted to create a new database in MySQL
called "webmail" and then also create a new user who limited to only
accessing the 'webmail' database and nothing else. Can someone please
tell me if I did this correctly or if I messed up and mis-understood
the instructions. I am sure there are easier ways to do this via
mysql-admin tool but I prefer to just try the way below unless its
dead wrong...

============================================================ =======

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 437
Server version: 5.0.45 Source distribution

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

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cal |
| forums |
| it |
| mysql |
+--------------------+
5 rows in set (0.00 sec)

mysql> create database webmail;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on webmail.* to dublin@localhost
identified by 'n0$n@ke$' with grant option;
Query OK, 0 rows affected (0.00 sec)

============================================================ =======

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Creating a New DB / User

am 13.05.2009 17:15:09 von Michael Dykman

Your directive looks fine assuming dublin expects to always connect
from localhost.

One thing though: your user does not need the 'WITH GRANT OPTION' bit
as that gives them permission to gratn permissions to other users,
which I don't think is what you want.

- michael dykman

On Wed, May 13, 2009 at 11:05 AM, Carlos Williams wr=
ote:
> I have used MySQL twice in my career so I did read the MySQL How-to
> page and just wanted to ask here if what I did as correct based on
> what I wanted to do. I just wanted to create a new database in MySQL
> called "webmail" and then also create a new user who limited to only
> accessing the 'webmail' database and nothing else. Can someone please
> tell me if I did this correctly or if I messed up and mis-understood
> the instructions. I am sure there are easier ways to do this via
> mysql-admin tool but I prefer to just try the way below unless its
> dead wrong...
>
> ==================== =====
==================== =====3D=
==================
>
> Welcome to the MySQL monitor. =A0Commands end with ; or \g.
> Your MySQL connection id is 437
> Server version: 5.0.45 Source distribution
>
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
> mysql> show databases;
> +--------------------+
> | Database =A0 =A0 =A0 =A0 =A0 |
> +--------------------+
> | information_schema |
> | cal =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
> | forums =A0 =A0 =A0 =A0 =A0 =A0 |
> | it =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
> | mysql =A0 =A0 =A0 =A0 =A0 =A0 =A0|
> +--------------------+
> 5 rows in set (0.00 sec)
>
> mysql> create database webmail;
> Query OK, 1 row affected (0.00 sec)
>
> mysql> grant all privileges on webmail.* to dublin@localhost
> identified by 'n0$n@ke$' with grant option;
> Query OK, 0 rows affected (0.00 sec)
>
> ==================== =====
==================== =====3D=
==================
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dmdykman@gmail=
..com
>
>



--=20
- michael dykman
- mdykman@gmail.com

- All models are wrong. Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Creating a New DB / User

am 13.05.2009 17:57:49 von Carlos Williams

On Wed, May 13, 2009 at 11:15 AM, Michael Dykman wrote:
> One thing though: your user does not need the 'WITH GRANT OPTION' bit
> as that gives them permission to gratn permissions to other users,
> which I don't think is what you want.

How do I change the bit for 'grant all' via the CLI? What command
would I run to keep the user
as having full rights to the 'dublin' database but not being able to
grant other users permissions?

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Creating a New DB / User

am 13.05.2009 18:00:50 von tibyke

Carlos Williams írta:
> On Wed, May 13, 2009 at 11:15 AM, Michael Dykman wrote:
>> One thing though: your user does not need the 'WITH GRANT OPTION' bit
>> as that gives them permission to gratn permissions to other users,
>> which I don't think is what you want.
>
> How do I change the bit for 'grant all' via the CLI? What command
> would I run to keep the user
> as having full rights to the 'dublin' database but not being able to
> grant other users permissions?
>

how about reading the fine manual of the GRANT command at mysql.com?

t

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Creating a New DB / User

am 13.05.2009 18:03:30 von Carlos Williams

2009/5/13 Pintér Tibor :
> how about reading the fine  manual of the GRANT command at mysql.com=
?

I did to avoid being lazy...go figure. I then decided to ask here
before I make a mistake & I felt the fine manual was not clear enough
for me...

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Creating a New DB / User

am 13.05.2009 23:41:33 von Kyong Kim

You would be fine.
Grant all does not include with grant option.
Ability to grant has to be given explicitly.
Kyong

At 08:57 AM 5/13/2009, Carlos Williams wrote:
>On Wed, May 13, 2009 at 11:15 AM, Michael Dykman wrote:
> > One thing though: your user does not need the 'WITH GRANT OPTION' bit
> > as that gives them permission to gratn permissions to other users,
> > which I don't think is what you want.
>
>How do I change the bit for 'grant all' via the CLI? What command
>would I run to keep the user
>as having full rights to the 'dublin' database but not being able to
>grant other users permissions?
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=kimkyong@fhda.edu


Kyong Kim
Instructional Multimedia/Web Programmer
Foothill College
12345 El Monte Rd
3601
Los Altos Hills, CA 94022
650-949-7091


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org