Create User

Create User...


CREATE USER '[username]'@'[userhost]' INDENTIFIED BY '[userpassword]'; CREATE USER '[username]' INDENTIFIED BY '[userpassword]'; CREATE USER 'kennyl'@'localhost' INDENTIFIED BY 'mypassword';

Users are stored in the user table of the mysql database... synical I know. The table has two keys; user and host . So it's possible to have multiple copies of the same username from different hosts. For example: 'kennyl'@'Remington' and 'kennyl'@'magnum' are two different users. Even though the user names are identical, the host is different, and since user has a joint key, they are different.

However, you don't really have to have a host. One could simply have a username and no host. MySQL will record the host name as %. So technically there is a host, but no one would know... unless they peeked in the user table.

By the way - user and host are always put in quotes:'kennyl'@'localhost'. Single, double... it doen't matter.

To create a user one must indicate the user, the host and the password or just the user and password. Syntax is like this:

... or just ...

... and the server will record the host name as %

Example:

When working interactivly in the MySQL client everything is recorded. It goes in a file called .mysql_history in the users home directory. If you create a user the exact syntax goes in this file including the password in plain text. Personnaly, I delete this file when I log out. NOTE:

ADDUSER syntax in the mysql manual.

CREATED 2012-11-19 02:28:07.0

00-17-E5

UPDATED 2012-11-25 16:10:35.0

What about Access?


Creating a user is just part of it. Now you need to get access to the objects in the database. Check out the GRANT statement.

CREATED 2012-11-22 04:12:40.0

00-18-2A

UPDATED 2012-11-22 04:12:46.0

Knowledge

L
I
N
K
S

DBID: db.wam

Page Server: Ruger

©2012 Leistware Data Systems

      Hello anonymous