LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-20-2012, 02:27 AM   #1
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163
Blog Entries: 1

Rep: Reputation: Disabled
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
 
Old 04-20-2012, 02:31 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Come on, we aren't your search engine... http://lmgtfy.com/?q=how+to+create+a...n+mysql+server
 
Old 04-20-2012, 02:31 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
Old 04-20-2012, 02:48 AM   #4
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
how to create a user in mysql server

Quote:
Originally Posted by acid_kewpie View Post
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

Last edited by suresh.k; 04-20-2012 at 02:52 AM.
 
Old 04-20-2012, 02:50 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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...
 
Old 04-20-2012, 02:56 AM   #6
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
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
 
Old 04-20-2012, 02:57 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 04-20-2012, 03:02 AM   #8
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
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.

Last edited by suresh.k; 04-20-2012 at 03:06 AM.
 
Old 04-20-2012, 03:12 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
The CREATE privilege enables creation of new databases and tables.
The DROP privilege enables you to drop (remove) existing databases, tables, and views.
 
Old 04-20-2012, 06:06 AM   #10
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
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.
 
Old 04-20-2012, 06:09 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
how did you configure the rights? What steps did you make?
 
Old 04-20-2012, 06:10 AM   #12
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by suresh.k View Post
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.
 
Old 04-20-2012, 06:16 AM   #13
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
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;
 
Old 04-20-2012, 06:20 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
try to revoke the drop privilege
 
Old 04-20-2012, 06:25 AM   #15
suresh.k
Member
 
Registered: Aug 2011
Location: Hyderabad, AP, India
Distribution: centos, Ubuntu
Posts: 163

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
try to revoke the drop privilege
Is like this
GRANT SELECT,INSERT,UPDATE,CREATE on suresh.* to 'suresh'@'localhost' identified by '123456';
FLUSH PRIVILEGES;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a mysql user SpeedyKun Linux - Server 9 12-07-2011 03:27 PM
How do I create a new mysql user and a mysql database at the shell prompt? puppymagic Linux - Newbie 1 08-07-2010 06:33 AM
can't create a user MySQL sycamorex Linux - Software 2 01-18-2008 04:06 PM
create mysql user sunhui Linux - Software 1 04-24-2006 12:02 AM
mysql cannot create a user nocturnal Linux - Software 1 07-05-2003 10:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration