Spec-Zone .ru
спецификации, руководства, описания, API
|
GUI tools exist that perform most of the tasks described below, including:
MySQL Installer: Used to install and upgrade MySQL products.
MySQL Workbench: Manages the MySQL server and edits SQL queries.
MySQL Notifier: Starts, stops, or restarts the MySQL server, and monitors its status.
MySQL for Excel: Edits MySQL data with Microsoft Excel.
On Windows, you need not create the data directory and the grant tables. MySQL Windows distributions include the
grant tables with a set of preinitialized accounts in the mysql
database under the
data directory. Regarding passwords, if you installed MySQL using the MySQL Installer, you may have already
assigned passwords to the accounts. (See Section
2.3.3, "Installing MySQL on Microsoft Windows Using MySQL Installer".) Otherwise, use the
password-assignment procedure given in Section 2.10.2,
"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.3.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. You may need to specify directory different from C:\mysql\bin
on the
command line. If you used the MySQL Installer, the default directory is C:\Program
Files\MySQL\MySQL Server 5.6
, and the mysql and mysqlshow client programs are in C:\Program
Files\MySQL\MySQL Server 5.6\bin
. See Section
2.3.3, "Installing MySQL on Microsoft Windows Using MySQL Installer", for more information.
Use mysqlshow to see what databases exist:
C:\> C:\mysql\bin\mysqlshow
+--------------------+| Databases |+--------------------+| information_schema || mysql || test |+--------------------+
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.
The preceding command (and commands for other MySQL programs such as mysql) may not work if the correct MySQL account does not exist.
For example, the program may fail with an error, or you may not be able to view all databases. If you installed
using MySQL Installer, then the root
user will have been created automatically with
the password you supplied. In this case, you should use the -u root
and -p
options. (You will also need to use the -u root
and
-p
options if you have already secured the initial MySQL accounts.) With -p
, you will be prompted for the root
password. For
example:
C:\>C:\mysql\bin\mysqlshow -u root -p
Enter password:(enter root password here)
+--------------------+| Databases |+--------------------+| information_schema || mysql || test |+--------------------+
If you specify a database name, mysqlshow displays a list of the tables within the database:
C:\> C:\mysql\bin\mysqlshow mysql
Database: mysql+---------------------------+| Tables |+---------------------------+| columns_priv || db || event || func || help_category || help_keyword || help_relation || help_topic || host || plugin || proc || procs_priv || servers || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+
Use the mysql program to select information from a table in the mysql
database:
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM
mysql.db"
+------+--------+------+| host | db | user |+------+--------+------+| % | test | || % | test_% | |+------+--------+------+
For more information about mysqlshow and mysql, 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, you can set up the MySQL server to run automatically when Windows starts. See Section 2.3.5.7, "Starting MySQL as a Windows Service".