Oracle 5.0 Reference Manual page 161

Table of Contents

Advertisement

shell>
mysqladmin -u root -p shutdown
Enter password:
Assigning Anonymous Account Passwords
The
commands in the following instructions include a
mysql
you have set the
password when connecting to the server.
To assign passwords to the anonymous accounts, connect to the server as root, then use either
or UPDATE. Be sure to encrypt the password using the
PASSWORD
To use
SET PASSWORD
shell>
mysql -u root -p
Enter password:
mysql>
SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
To use
SET PASSWORD
shell>
mysql -u root -p
Enter password:
mysql>
SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
mysql>
SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
To set the anonymous-user account passwords with a single
platform):
shell>
mysql -u root -p
Enter password:
mysql>
UPDATE mysql.user SET Password = PASSWORD('newpwd')
->
WHERE User = '';
mysql>
FLUSH PRIVILEGES;
The
statement causes the server to reread the grant tables. Without it, the password change
FLUSH
remains unnoticed by the server until you restart it.
Removing Anonymous Accounts
If you prefer to remove any anonymous accounts rather than assigning them passwords, do so as
follows on Windows:
shell>
mysql -u root -p
Enter password:
mysql>
DROP USER ''@'localhost';
On Unix, remove the anonymous accounts like this:
shell>
mysql -u root -p
Enter password:
mysql>
DROP USER ''@'localhost';
mysql>
DROP USER ''@'host_name';
Securing Test Databases
By default, the
and other databases with names that start with test_. (These rows have an empty
value, which for access-checking purposes matches any user name.) This means that such databases
can be used even by accounts that otherwise possess no privileges. If you want to remove any-user
access to test databases, do so as follows:
shell>
mysql -u root -p
Enter password:
mysql>
DELETE FROM mysql.db WHERE Db LIKE 'test%';
Securing the Initial MySQL Accounts
(enter root password here)
account passwords using the preceding instructions and must specify that
root
on Windows, do this:
(enter root password here)
on Unix, do this:
(enter root password here)
(enter root password here)
(enter root password here)
(enter root password here)
table contains rows that permit access by any user to the
mysql.db
(enter root password here)
option based on the assumption that
-p
PASSWORD()
UPDATE
141
[956]
function.
statement, do this (on any
database
test
column
User
SET

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents