Oracle 5.0 Reference Manual page 618

Table of Contents

Advertisement

user account has a more specific
comes earlier in the
Control, Stage 1: Connection
• The
'admin'@'localhost'
to connect from the local host. It is granted the
privileges. These privileges enable the
refresh, and
mysqladmin
. No privileges are granted for accessing any databases. You could add such
processlist
privileges later by issuing other
• The
'dummy'@'localhost'
from the local host. No privileges are granted. It is assumed that you will grant specific privileges to
the account later.
The statements that create accounts with no password will fail if the
SQL mode is enabled. To deal with this, use an
password.
To check the privileges for an account, use
mysql>
SHOW GRANTS FOR 'admin'@'localhost';
+-----------------------------------------------------+
| Grants for admin@localhost
+-----------------------------------------------------+
| GRANT RELOAD, PROCESS ON *.* TO 'admin'@'localhost' |
+-----------------------------------------------------+
As an alternative to
CREATE USER
statements and then telling the server to reload the grant tables using
INSERT
shell>
mysql --user=root mysql
mysql>
INSERT INTO user
->
VALUES('localhost','monty',PASSWORD('some_pass'),
->
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
mysql>
INSERT INTO user
->
VALUES('%','monty',PASSWORD('some_pass'),
->
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
->
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
->
'','','','',0,0,0,0);
mysql>
INSERT INTO user SET Host='localhost',User='admin',
->
Reload_priv='Y', Process_priv='Y';
mysql>
INSERT INTO user (Host,User,Password)
->
VALUES('localhost','dummy','');
mysql>
FLUSH PRIVILEGES;
When you create accounts with INSERT, it is necessary to use
to reload the grant tables. Otherwise, the changes go unnoticed until you restart the server. With
CREATE
USER,
FLUSH PRIVILEGES
The reason for using the
statement encrypts the password for you, so
CREATE USER
The
values enable privileges for the accounts. Depending on your MySQL version, you may have
'Y'
to use a different number of
the
account employs the more readable extended
admin
In the
statement for the
INSERT
the
table row are assigned values. None of the privilege columns are set explicitly, so MySQL
user
assigns them all the default value of 'N'. This is equivalent to what
If strict SQL mode is enabled, all columns that have no default value must have a value specified. In
this case,
statements must explicitly specify values for the ssl_cipher, x509_issuer, and
INSERT
columns.
x509_subject
Adding User Accounts
column value than the
Host
table sort order.
user
Verification".)
account has no password. This account can be used only by
admin
mysqladmin flush-xxx
statements.
GRANT
account has no password. This account can be used only to connect
SHOW
and GRANT, you can create the same accounts directly by issuing
is unnecessary.
[956]
PASSWORD()
values in the first two
'Y'
account, only the Host, User, and
dummy
598
'monty'@'%'
(user
table sorting is discussed in
[577]
and
RELOAD
user to execute the
commands, as well as
clause that specifies a nonempty
IDENTIFIED BY
GRANTS:
|
FLUSH PRIVILEGES
function with
is to encrypt the password. The
INSERT
PASSWORD()
statements. The
INSERT
syntax using SET.
INSERT
account and thus
Section 6.2.4, "Access
[577]
administrative
PROCESS
mysqladmin
reload,
mysqladmin
NO_AUTO_CREATE_USER
FLUSH
PRIVILEGES:
to tell the server
[956]
is unnecessary.
statement for
INSERT
columns in
Password
does.
CREATE USER
admin
[536]

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents