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 2.9.3, “Using the MySQL Installation Wizard”.) Otherwise, use the
password-assignment procedure given in
Section 2.17.3, “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 2.9.9, “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:
shell>C:\mysql\bin\mysqlshow
+--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | test | +--------------------+ shell>C:\mysql\bin\mysqlshow mysql
Database: mysql +---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | func | | help_category | | help_keyword | | help_relation | | help_topic | | host | | proc | | procs_priv | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ shell>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.0
, and the
mysql and mysqlshow client
programs are in C:\Program Files\MySQL\MySQL Server
5.0\bin
. See
Section 2.9.3, “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:
shell>C:\mysql\bin\mysqlshow -uroot -psecretpass
+--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | test | +--------------------+ shell>C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
Database: mysql +---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | func | | help_category | | help_keyword | | help_relation | | help_topic | | host | | proc | | procs_priv | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ shell>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 Section 4.5.6, “mysqlshow — Display Database, Table, and Column Information”, and Section 4.5.1, “mysql — The MySQL Command-Line Tool”.
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 2.9.11, “Starting MySQL as a Windows Service”.
User Comments
On Windows, if you get a message while using mysqlshow:
mysqlshow: Access denied for user 'ODBC'@'localhost' (using password: NO)
this means you have no user "ODBC". Instead try:
>mysqlshow -u root
which forces to log in as "root".
If then you would get:
mysqlshow: Access denied for user 'root'@'localhost' (using password: NO)
this means you should force mysql to use a password:
>mysqlshow -u root -p
Then type your root password (that you defined during installation).
I spent a lot of time for this simple problem.
Add your own comment.