Username/Password Basics

2004-06-02 Thread David Blomstrom
I've been studying MySQL for a few weeks now and am
about ready to publish some databases online. But I'm
confused about usernames and passwords. I understand
you can create usernames and passwords on three or
four different levels, like root, database, etc. As I
understand it, localhost is the standard platform on
which all the databases rest.

I believe all my databases have the same setting -
localhost, newbie_user, Newbie

Those aren't my real username and password, of course.
But I THINK newbie_user and Newbie are the username
and password for localhost, and none of my databases
have usernames or passwords. So how do I create one?

I thought I remembered seeing the password command in
phpMyAdmin, but I can't find it now.

And if I create a database username and password on
top of a localhost username and password, am I going
to have to log in with two usernames and passwords?

Then again, I could be mistaken about the localhost
username and password; it might be that newbie_user
and Newbie are a DATABASE username and password shared
by all my databases.




__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Username/Password Basics

2004-06-02 Thread Lou Olsten
David,

Think of users as the concatenation of the user and the host from which the
user is connecting.  That's why in your GRANT statement, you will see the
'user'@'host' semantic employed.

When you say 'localhost' you're telling MySQL that the user you are
specifying is connecting from the local host.  So, [EMAIL PROTECTED] is
really one user, [EMAIL PROTECTED] is another user, and so on.  When MySQL
resolves the connection, I believe it first looks at the host for
resolution.

You do not have to put a user into the system for every location from which
you want to connect.  Instead, you can use wildcards like:
GRANT  ON *.* to 'Newbie'@'196.168.168.%'

or maybe 'Newbie'@'%.yourdomain.com'

Lou

- Original Message - 
From: David Blomstrom [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 02, 2004 10:22 AM
Subject: Username/Password Basics


 I've been studying MySQL for a few weeks now and am
 about ready to publish some databases online. But I'm
 confused about usernames and passwords. I understand
 you can create usernames and passwords on three or
 four different levels, like root, database, etc. As I
 understand it, localhost is the standard platform on
 which all the databases rest.

 I believe all my databases have the same setting -
 localhost, newbie_user, Newbie

 Those aren't my real username and password, of course.
 But I THINK newbie_user and Newbie are the username
 and password for localhost, and none of my databases
 have usernames or passwords. So how do I create one?

 I thought I remembered seeing the password command in
 phpMyAdmin, but I can't find it now.

 And if I create a database username and password on
 top of a localhost username and password, am I going
 to have to log in with two usernames and passwords?

 Then again, I could be mistaken about the localhost
 username and password; it might be that newbie_user
 and Newbie are a DATABASE username and password shared
 by all my databases.




 __
 Do you Yahoo!?
 Friends.  Fun.  Try the all-new Yahoo! Messenger.
 http://messenger.yahoo.com/

 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Username/Password Basics

2004-06-02 Thread Paul DuBois
At 7:22 -0700 6/2/04, David Blomstrom wrote:
I've been studying MySQL for a few weeks now and am
about ready to publish some databases online. But I'm
confused about usernames and passwords. I understand
you can create usernames and passwords on three or
four different levels, like root, database, etc. As I
understand it, localhost is the standard platform on
which all the databases rest.
No.
You can assign *privileges* at four levels: global, database,
table, column.  These are stored in the user, db, tables_priv,
and columns_priv tables in the mysql database.
Privileges are associated with user accounts.  An account
is defined as a host + user value combination.  These are
stored in the Host and User columns of the user table,
along with any global privileges the account has.  The account
password is stored in the Password column of the user table.
I believe all my databases have the same setting -
localhost, newbie_user, Newbie
Those aren't my real username and password, of course.
But I THINK newbie_user and Newbie are the username
and password for localhost, and none of my databases
have usernames or passwords. So how do I create one?
Databases don't have passwords. Accounts do.  The accounts
can be assigned database-level privileges.

I thought I remembered seeing the password command in
phpMyAdmin, but I can't find it now.
Can't help you there.  However, I suggest that if you want
to know how the MySQL access control system works, you read
the relevant sections of the MySQL Reference Manual.  I
would not try to intuit it from how phpMyAdmin works.
http://dev.mysql.com/doc/mysql/en/Privilege_system.html
http://dev.mysql.com/doc/mysql/en/User_Account_Management.html

And if I create a database username and password on
top of a localhost username and password, am I going
to have to log in with two usernames and passwords?
Then again, I could be mistaken about the localhost
username and password; it might be that newbie_user
and Newbie are a DATABASE username and password shared
by all my databases.
It sounds like your conceptual model is backwards.  It
might serve you best to toss out that model and read
through the sections of the manual noted above.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Username/Password Basics

2004-06-02 Thread David Blomstrom
Lou Olsten wrote, You do not have to put a user into
the system for every location from 
which
you want to connect.  Instead, you can use wildcards
like:
GRANT  ON *.* to 'Newbie'@'196.168.168.%'

or maybe 'Newbie'@'%.yourdomain.com'

I don't know how to work with wildcards, but are you
describing something I could also do with echo
statements? It's a pain in the butt using the same
database on two different websites with different
usernames and passwords, like david_works and
japan_works.

For example, one of my webpages begins with the
following code:

?php
@mysql_connect (localhost , testuser ,
TestUser);
@mysql_select_db (world);

Could I replace that with this?:

?php
$username = 'webhost_testuser';
$password = 'webhost_pass';
$database = 'world';
@mysql_connect (localhost , ' . $username . ' , '
. $password . ');
@mysql_select_db (database);


--- Paul DuBois [EMAIL PROTECTED] wrote:
 At 7:22 -0700 6/2/04, David Blomstrom wrote:
 I've been studying MySQL for a few weeks now and am
 about ready to publish some databases online. But
 I'm
 confused about usernames and passwords. I
 understand
 you can create usernames and passwords on three or
 four different levels, like root, database, etc. As
 I
 understand it, localhost is the standard platform
 on
 which all the databases rest.
 
 No.
 
 You can assign *privileges* at four levels: global,
 database,
 table, column.  These are stored in the user, db,
 tables_priv,
 and columns_priv tables in the mysql database. . . .

 I thought I remembered seeing the password command
 in
 phpMyAdmin, but I can't find it now.
 
 Can't help you there.  However, I suggest that if
 you want
 to know how the MySQL access control system works,
 you read
 the relevant sections of the MySQL Reference Manual.
  I
 would not try to intuit it from how phpMyAdmin
 works.
 

http://dev.mysql.com/doc/mysql/en/Privilege_system.html
http://dev.mysql.com/doc/mysql/en/User_Account_Management.html

H... to make this easier to understand, let me
break this down into three sections:

1. What system do I have in operation now?
2. What system SHOULD I have?
3. How do I get there?

I put some screen shots from a program called Navicat
online at http://www.geoworld.org/userpass.gif

In picture #1, you see my eight databases listed on
the left. The tables inside database world are
listed on the right.

When I click Manage Users, I see the following:

%localhost
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

I created [EMAIL PROTECTED] and [EMAIL PROTECTED]; one
or more of the others are default usernames.

Picture 5 illustrates that all eight databases appear
inside each user's folder. So users can be thought of
as people, and each of these people has access to each
database, right?

Note the note at the bottom of picture 6:

No privileges are currently set for the selected
option.

So that's what I have. Now, what SHOULD I have?

I'm the only person using my computer. I don't
envision anyone else working with my databases, unless
I create some tables that visitors can add information
to using PHP add/edit forms.

I'm going to have at least two major databases, one
focusing on geography, the other on animals. I'll have
others, but these will do as an example.

Since I'm presently the only user, which of the
following should/could I discard? In other words,
let's say I choose minx as a new username, allowing
me to discard testuser. And minx gives me access to
both the World and Animals databases. Can I discard
all the other usernames, or should I retain one or
more?

%localhost
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

And what global privileges should I use?

I think I've answered the third question; it looks
like I can add and delete users with Navicat (so I'm
going to have to buy it! :)

Thanks.





__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]