[vox-tech] mysql: printing all users and databases

Michael J Wenk vox-tech@lists.lugod.org
Tue, 16 Mar 2004 00:59:11 -0800


On Mon, Mar 15, 2004 at 09:03:01AM -0800, Peter Jay Salzman wrote:
> thanks tim,
> 
> i'll give it a try.  i have to say, i'm a little disheartened with
> mysql.  i just want it to "work" and be secure.

Well, what do you want it to do ? It pretty well works out of the box,
but it requires a bit of DBA and DB(SQL) programming skill, if you have
neither or are weak and unwilling to devote time to get that, then I
suggest you give up, or shelf the project til you have time. 

> from reading the docs, it _appears_ (although it doesn't say explicitly)
> that not only does each username have a password, each user has a
> password for each hostname.  so 'root'@'localhost' may have a different
> password than 'root'@'someotherhost'.  that's just too bizarre for my
> mind.

You can make users host specific.  You do not have to.  While its true
that root@% is different than root@localhost, its not too hard too make
the jump(the user name is different after all.)  The only issue with
this, I would recommend making your dba user acct localhost only(that
way, you're guarenteed that if someone does break in, they have to be a
local user, and if they can become a local user, then its likely they'll
just be able to read the table data off the filesystem.)

> it also looks like a database name of "mysql" may refer to the
> collection of all databases, but i haven't verified that yet.

mysql is a special database created by the mysql_install_db script.  It
contains your user/db permissions.  In fact a user is just a row in the
user table(a table is slightly different, its not just a row, as there
are filesystem objects required, but a table must have a row in the db
table for the system to see it.  However, for the most part, the mysql
database is a normal database, and you can use sql to insert or delete
rows(tho for most things its better to use the proper commands) 

> plus having anonymous users... really, anonymous.  as in, so anonymous
> that they don't even have a username, is a really strange concept.  even
> anonymous ftp users have a username of "anonymous".

They have a username.  The username is "".  usernames can be any
character that can fit in a varchar(16) field.  While this is odd, its
no more odd than having a username be restricted to 8 characters, and
have passwords not containing @ or #.  
 
> i wanted to set up a slashcode system, but i may just put that off till
> i have more time to sit down and read mysql docs.  the more i learn
> about mysql, the more i'm starting to realize there's no possible
> quickstart...   :(

Again, it depends what you want to do.  If you have an existing system,
usually they have scripts that will do all the table structure and crap
for you.  If you're developing it yourself, its much more difficult and
way more time consuming.  BTW, mysql is pretty simple when compared with
oracle, or even pgsql.  

Mike