School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,492 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,847 people online right now. Registration is fast and FREE... Join Now!




database users

 

database users

jamesb

1 Jul, 2008 - 04:38 AM
Post #1

New D.I.C Head
*

Joined: 24 Jun, 2008
Posts: 30


My Contributions
I have MySQL on my xp machine here at work and am going through the tutorial in the MySQL 5.0 Reference Manual.

Manual link

And I am not very far in it, but I believe I found a question that the tutorial won't cover. If I were to have a database on the internet for a site that users had to log into...would I need a database user for each website login or could all web users have the same database username?

User is offlineProfile CardPM
+Quote Post


orcasquall

RE: Database Users

1 Jul, 2008 - 07:43 AM
Post #2

D.I.C Head
Group Icon

Joined: 14 Sep, 2007
Posts: 158



Thanked: 10 times
Dream Kudos: 50
My Contributions
I'm assuming you want your site to be popular (obvious I know, but still need to state...). Since that's the case, creating an individual database user for every user would be tedious, to say the least. Perhaps even undesirable.

Create a database user with just enough rights to do whatever a web visitor can do. Then whenever a database connection is needed, use that special user ID.

I suggest using a database table to store user information, one record for every user. Of the columns for this table, two are the most important, the user login ID, and the associated password.

You do know how to encrypt passwords right? Storing a hash of the plaintext password is usually the norm.

Then when a user logs in, connect to the database with the special ID, then check if the user-given ID exists in the database, together with the correct password. If all goes well, log the user in.

This is how I'd do it. Any experts reading this, please give your thoughts too. I'd love to hear any alternatives.
User is offlineProfile CardPM
+Quote Post

jamesb

RE: Database Users

1 Jul, 2008 - 08:15 AM
Post #3

New D.I.C Head
*

Joined: 24 Jun, 2008
Posts: 30


My Contributions
QUOTE(orcasquall @ 1 Jul, 2008 - 08:43 AM) *

I'm assuming you want your site to be popular (obvious I know, but still need to state...). Since that's the case, creating an individual database user for every user would be tedious, to say the least. Perhaps even undesirable.

Create a database user with just enough rights to do whatever a web visitor can do. Then whenever a database connection is needed, use that special user ID.


Popularity is null, simply looking at how things can be done; database philosophy?

But you say it can be done both ways, thanks!

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:35AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month