On Windows, the data directory and the grant tables do not have to
be created. MySQL Windows distributions include the grant tables
with a set of preinitialized accounts in the
mysql
database under the data directory. It is
unnecessary to run the mysql_install_db script
that is used on Unix. Regarding passwords, if you installed MySQL
using the Windows Installation Wizard, you may have already
assigned passwords to the accounts. (See
Section 1.3.1, “Using the MySQL Installation Wizard”.) Otherwise, use the
password-assignment procedure given in
Securing the Initial MySQL Accounts.
Before setting up passwords, you might want to try running some client programs to make sure that you can connect to the server and that it is operating properly. Make sure that the server is running (see Section 1.5.4, “Starting the Server for the First Time”), and then issue the following commands to verify that you can retrieve information from the server. The output should be similar to what is shown here:
C:\> C:\mysql\bin\mysqlshow
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
The above may not work if the correct user does not exist. If
you installed using the MSI packages and used the MySQL Server
Instance Config Wizard, then the root
will
haqve been created automatically with the password you supplied.
In this case, you should use the -u
and
-p
options where you will be prompted for the
password.
The list of installed databases may vary, but will always
include the minimum of mysql
and
information_schema
. In most cases, the
test
database will also be installed
automatically.
If you specify the name of the database, then a list of the tables within a given database will be displayed:
C:\>C:\mysql\bin\mysqlshow mysql
Database: mysql +---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | plugin | | proc | | procs_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ C:\>C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
+------+-------+------+ | host | db | user | +------+-------+------+ | % | test% | | +------+-------+------+
You may need to specify a different directory from the one shown;
if you used the Windows Installation Wizard, then the default
directory is C:\Program Files\MySQL\MySQL Server
5.1
, and the mysql and
mysqlshow client programs are in
C:\Program Files\MySQL\MySQL Server
5.1\bin
. See
Section 1.3.1, “Using the MySQL Installation Wizard”, for more information.
If you have already secured the initial MySQL accounts, you may
need to use the -u
and -p
options to supply a user name and password to the
mysqlshow and mysql client
programs; otherwise the programs may fail with an error, or you
may not be able to view all databases. For example, if you have
assigned the password “secretpass” to the MySQL
root
account, then you can invoke
mysqlshow and mysql as shown
here:
C:\>C:\mysql\bin\mysqlshow -uroot -psecretpass
+--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | test | +--------------------+ C:\>C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
Database: mysql +---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | plugin | | proc | | procs_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ C:\>C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User FROM db" mysql
+------+-------+------+ | host | db | user | +------+-------+------+ | % | test% | | +------+-------+------+
For more information about these programs, see mysqlshow, and mysql.
If you are running a version of Windows that supports services and you want the MySQL server to run automatically when Windows starts, see Section 1.5.6, “Starting MySQL as a Windows Service”.