[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
On Windows, the grant tables do not have to be created. MySQL Windows
distributions include the grant tables already set up in the
mysql
database under the `data' directory. However, you
should assign passwords to the accounts.
The default privileges on Windows give all local users full privileges
to all databases without specifying a password. To make MySQL
more secure, you should set a password for all users and remove the row in
the mysql.user
table that has Host='localhost'
and
User="
.
You should also add a password for the root
user. The following
example starts by removing the anonymous user that has all privileges,
then sets a root
user password:
C:\> C:\mysql\bin\mysql mysql mysql> DELETE FROM user WHERE Host='localhost' AND User=''; mysql> FLUSH PRIVILEGES; mysql> QUIT C:\> C:\mysql\bin\mysqladmin -u root password your_password |
After you've set the password, if you want to shut down the mysqld
server, you can do so using this command:
C:\> mysqladmin --user=root --password=your_password shutdown |
If you are using a server from a very old version of MySQL,
the mysqladmin
command to set the
password will fail with an error: parse error near 'SET
password'
. The solution to this problem is to upgrade to a newer
version of MySQL.
With the current MySQL versions you can easily add new users
and change privileges with GRANT
and REVOKE
commands.
See section GRANT
.