LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to create a user in mysql server (https://www.linuxquestions.org/questions/linux-server-73/how-to-create-a-user-in-mysql-server-940789/)

suresh.k 04-20-2012 02:27 AM

how to create a user in mysql server
 
hi,
In centos how to create a user in mysql server, the user can create the database but he should not able to delete that databases.


Thanks
suresh

acid_kewpie 04-20-2012 02:31 AM

Come on, we aren't your search engine... http://lmgtfy.com/?q=how+to+create+a...n+mysql+server

pan64 04-20-2012 02:31 AM

you will have a dbadmin who has right to do anything. Either add users or add/revoke permissions to any db user. you can see here the privileges, so you can add create privilege, but do not add drop privilege.

suresh.k 04-20-2012 02:48 AM

how to create a user in mysql server
 
Quote:

Originally Posted by acid_kewpie (Post 4658080)
Come on, we aren't your search engine... http://lmgtfy.com/?q=how+to+create+a...n+mysql+server

Hellooooo

I know how to creata a user, and i know that to search in google.
here,
I created a user, and logged into that user, but he can't able to create a database, so that i granted privileges to *.* to user@localhost, with this he can able to create the database but also he can delete that database.
so that here i want to creata a user who can creata a database and he should not delete that database.


Suresh

acid_kewpie 04-20-2012 02:50 AM

In that case, please try to make make the effort to ask the right question in the first place, with a suitable amount of detail...

suresh.k 04-20-2012 02:56 AM

Quote:

Originally Posted by acid_kewpie (Post 4658091)
In that case, please try to make make the effort to ask the right question in the first place, with a suitable amount of detail...

In the first post also i mentioned properly only, please go through once

acid_kewpie 04-20-2012 02:57 AM

so the next google you should have done would have got you here in seconds - http://dev.mysql.com/doc/refman/5.0/...html#priv_drop and you can see there is no specific "Drop database" privilege, you just permit create or drop on everything. so you can grant create and not drop, but that means they also couldn't drop tables, views etc.

more googling gets you here - http://bugs.mysql.com/bug.php?id=18938 where people are asking for a distinction between the types of drop.

suresh.k 04-20-2012 03:02 AM

Quote:

Originally Posted by pan64 (Post 4658081)
you will have a dbadmin who has right to do anything. Either add users or add/revoke permissions to any db user. you can see here the privileges, so you can add create privilege, but do not add drop privilege.

Thanks for ur replay

If i do not add drop privilege to user then the user can able to drop their tables in database.
i want user to drop tables.

pan64 04-20-2012 03:12 AM

The CREATE privilege enables creation of new databases and tables.
The DROP privilege enables you to drop (remove) existing databases, tables, and views.

suresh.k 04-20-2012 06:06 AM

Quote:

Originally Posted by pan64 (Post 4658111)
The CREATE privilege enables creation of new databases and tables.
The DROP privilege enables you to drop (remove) existing databases, tables, and views.

Hi Pan64
I want user can create the database and he should not able to delete the database, but he should able to delete tables.

pan64 04-20-2012 06:09 AM

how did you configure the rights? What steps did you make?

TenTenths 04-20-2012 06:10 AM

Quote:

Originally Posted by suresh.k (Post 4658202)
he should not able to delete the database, but he should able to delete tables.

Did you actually READ any of the pages on permissions, there is no such permission to allow this. Let me make it clear: YOU CAN NOT GIVE A USER PERMISSIONS TO DROP JUST TABLES.

suresh.k 04-20-2012 06:16 AM

Quote:

Originally Posted by pan64 (Post 4658204)
how did you configure the rights? What steps did you make?

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE on suresh.* to 'suresh'@'localhost' identified by '123456';
FLUSH PRIVILEGES;

pan64 04-20-2012 06:20 AM

try to revoke the drop privilege

suresh.k 04-20-2012 06:25 AM

Quote:

Originally Posted by pan64 (Post 4658215)
try to revoke the drop privilege

Is like this
GRANT SELECT,INSERT,UPDATE,CREATE on suresh.* to 'suresh'@'localhost' identified by '123456';
FLUSH PRIVILEGES;


All times are GMT -5. The time now is 06:36 AM.