13
13
distributions, see Section 2.3, "Installing MySQL on
14
14
Microsoft Windows."
16
To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
16
To obtain MySQL, see Section 2.1.2, "How to Get MySQL."
18
18
MySQL compressed tar file binary distributions have names of
19
19
the form mysql-VERSION-OS.tar.gz, where VERSION is a number
20
(for example, 5.6.23), and OS indicates the type of operating
20
(for example, 5.6.25), and OS indicates the type of operating
21
21
system for which the distribution is intended (for example,
22
22
pc-linux-i686 or winx64).
24
To install MySQL from a compressed tar file binary
25
distribution, your system must have GNU gunzip to uncompress
26
the distribution and a reasonable tar to unpack it. If your
27
tar program supports the z option, it can both uncompress and
30
GNU tar is known to work. The standard tar provided with some
31
operating systems is not able to unpack the long file names
32
in the MySQL distribution. You should download and install
33
GNU tar, or if available, use a preinstalled version of GNU
34
tar. Usually this is available as gnutar, gtar, or as tar
35
within a GNU or Free Software directory, such as /usr/sfw/bin
36
or /usr/local/bin. GNU tar is available from
37
http://www.gnu.org/software/tar/.
40
25
If you have previously installed MySQL using your operating
41
26
system native package management system, such as yum or
42
27
apt-get, you may experience problems installing using a
43
native binary. Make sure your previous MySQL previous
44
installation has been removed entirely (using your package
45
management system), and that any additional files, such as
46
old versions of your data files, have also been removed. You
47
should also check the existence of configuration files such
48
as /etc/my.cnf or the /etc/mysql directory have been deleted.
28
native binary. Make sure your previous MySQL installation has
29
been removed entirely (using your package management system),
30
and that any additional files, such as old versions of your
31
data files, have also been removed. You should also check for
32
configuration files such as /etc/my.cnf or the /etc/mysql
33
directory and delete them.
35
For information about replacing third-party packages with
36
official MySQL packages, see the related Apt guide
37
(http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/) or
51
41
MySQL has a dependency on the libaio library. The
107
95
# Next command is optional
108
96
shell> cp support-files/mysql.server /etc/init.d/mysql.server
110
mysql_install_db creates a default option file named my.cnf
111
in the base installation directory. This file is created from
112
a template included in the distribution package named
113
my-default.cnf. For more information, see Section 5.1.2.2,
114
"Using a Sample Default Server Configuration File."
116
A more detailed version of the preceding description for
117
installing a binary distribution follows.
120
100
This procedure assumes that you have root (administrator)
121
101
access to your system. Alternatively, you can prefix each
122
102
command using the sudo (Linux) or pfexec (OpenSolaris)
125
The procedure does not set up any passwords for MySQL
126
accounts. After following the procedure, proceed to Section
127
2.10.2, "Securing the Initial MySQL Accounts."
106
The procedure does not assign passwords to MySQL accounts. To
107
do so, use the instructions in Section 2.10.4, "Securing the
108
Initial MySQL Accounts."
110
As of MySQL 5.6.8, mysql_install_db creates a default option
111
file named my.cnf in the base installation directory. This
112
file is created from a template included in the distribution
113
package named my-default.cnf. For more information, see
114
Section 5.1.2.2, "Using a Sample Default Server Configuration
117
A more detailed version of the preceding description for
118
installing a binary distribution follows.
129
120
Create a mysql User and Group
131
If your system does not already have a user and group for
132
mysqld to run as, you may need to create one. The following
122
If your system does not already have a user and group to use
123
for running mysqld, you may need to create one. The following
133
124
commands add the mysql group and the mysql user. You might
134
125
want to call the user and group something else instead of
135
126
mysql. If so, substitute the appropriate name in the
174
165
enables you to refer more easily to the installation
175
166
directory as /usr/local/mysql.
168
To install MySQL from a compressed tar file binary
169
distribution, your system must have GNU gunzip to uncompress
170
the distribution and a reasonable tar to unpack it. If your
171
tar program supports the z option, it can both uncompress and
174
GNU tar is known to work. The standard tar provided with some
175
operating systems is not able to unpack the long file names
176
in the MySQL distribution. You should download and install
177
GNU tar, or if available, use a preinstalled version of GNU
178
tar. Usually this is available as gnutar, gtar, or as tar
179
within a GNU or Free Software directory, such as /usr/sfw/bin
180
or /usr/local/bin. GNU tar is available from
181
http://www.gnu.org/software/tar/.
177
183
If your tar does not have z option support, use gunzip to
178
184
unpack the distribution and tar to unpack it. Replace the
179
185
preceding tar command with the following alternative command
183
189
Perform Postinstallation Setup
185
The remainder of the installation process involves setting up
186
the configuration file, creating the core databases, and
187
starting the MySQL server. For next steps, see Section 2.10,
191
The remainder of the installation process involves setting
192
distribution ownership and access permissions, initializing
193
the data directory, starting the MySQL server, and setting up
194
the configuration file. For instructions, see Section 2.10,
188
195
"Postinstallation Setup and Testing."
191
The accounts that are listed in the MySQL grant tables
192
initially have no passwords. After starting the server, you
193
should set up passwords for them using the instructions in
194
Section 2.10.2, "Securing the Initial MySQL Accounts."
195
196
2.3 Installing MySQL on Microsoft Windows
197
198
There are several different methods to install MySQL on
292
293
MySQL distributions for Windows can be downloaded from
293
http://dev.mysql.com/downloads/. See Section 2.1.3, "How to
294
http://dev.mysql.com/downloads/. See Section 2.1.2, "How to
296
297
MySQL for Windows is available in several distribution
297
formats, detailed below. Generally speaking, you should use
298
formats, detailed here. Generally speaking, you should use
298
299
MySQL Installer. It contains more features and MySQL products
299
than the older MSI, is simpler to use than the ZIP file, and
300
than the older MSI, is simpler to use than the Zip file, and
300
301
you need no additional tools to get MySQL up and running.
301
302
MySQL Installer automatically installs MySQL Server and
302
303
additional MySQL products, creates an options file, starts
884
884
2.3.3.1.3 Alter MySQL Products
886
MySQL Installer offers several options to alter your MySQL
887
product installations.
886
Use MySQL Installer to modify, configure, or upgrade your
887
MySQL product installations.
891
MySQL products with an available upgrade are highlighted on
892
the main dashboard. Products with available upgrades will
893
have an upgrade icon next to their version number.
891
Upgradable MySQL products are listed on the main dashboard
892
with an arrow icon ( [wb-icon-upgrade-arrow.png] ) next to
893
their version number.
895
895
Figure 2.25 MySQL Installer - Upgrade a MySQL Product
896
896
MySQL Installer - Upgrade a MySQL Product
899
Available upgrades are determined by having a current
900
catalog. For information about keeping your MySQL product
901
catalog current, see Section 2.3.3.1.1, "MySQL Product
899
The "upgrade" functionality requires a current product
900
catalog. This catalog is updated either manually or
901
automatically (daily) by enabling the Automatic Catalog
902
Update feature. For additional information, see Section
903
2.3.3.1.1, "MySQL Product Catalog."
904
Click Upgrade to view a list upgradable products. Our example
905
indicates that MySQL server 5.6.19 can be upgraded to version
905
Click Upgrade to upgrade the available products. Our example
906
indicates that MySQL Workbench 6.2.4 can be upgraded version
907
6.3.1 or 6.2.5, and MySQL server from 5.5.41 to 5.5.42.
908
909
Figure 2.26 MySQL Installer - Select Products To Upgrade
909
910
MySQL Installer - Select Products To Upgrade
911
Select (check) the products to upgrade, and optionally click
912
the changes link to view the product's release notes in your
913
browser. Click Next to begin the upgrade process.
912
If multiple upgrade versions are available (such as our MySQL
913
Workbench example above), select the desired version for the
914
upgrade in the Available Upgrades area.
917
Optionally, click the Changes link to view the version's
920
After selecting (checking) the products and versions to
921
upgrade, click Next to begin the upgrade process.
915
923
Figure 2.27 MySQL Installer - Apply Updates
916
924
MySQL Installer - Apply Updates
2292
2302
http://www.microsoft.com/windows2000/techinfo/reskit/tool
2293
2303
s/existing/delsrv-o.asp and use the delsrv mysql syntax.
2295
2.3.7 Upgrading MySQL on Windows
2305
2.3.7 Windows Postinstallation Procedures
2307
GUI tools exist that perform most of the tasks described in
2308
this section, including:
2310
* MySQL Installer: Used to install and upgrade MySQL
2313
* MySQL Workbench: Manages the MySQL server and edits SQL
2316
* MySQL Notifier: Starts, stops, or restarts the MySQL
2317
server, and monitors its status.
2320
(http://dev.mysql.com/doc/mysql-for-excel/en/index.html):
2321
Edits MySQL data with Microsoft Excel.
2323
On Windows, you need not create the data directory and the
2324
grant tables. MySQL Windows distributions include the grant
2325
tables with a set of preinitialized accounts in the mysql
2326
database under the data directory.
2328
Regarding passwords, if you installed MySQL using the MySQL
2329
Installer, you may have already assigned passwords to the
2330
accounts. (See Section 2.3.3, "Installing MySQL on Microsoft
2331
Windows Using MySQL Installer.") Otherwise, use the
2332
password-assignment procedure given in Section 2.10.4,
2333
"Securing the Initial MySQL Accounts."
2335
Before assigning passwords, you might want to try running
2336
some client programs to make sure that you can connect to the
2337
server and that it is operating properly. Make sure that the
2338
server is running (see Section 2.3.5.4, "Starting the Server
2339
for the First Time"). You can also set up a MySQL service
2340
that runs automatically when Windows starts (see Section
2341
2.3.5.7, "Starting MySQL as a Windows Service").
2343
These instructions assume that your current location is the
2344
MySQL installation directory and that it has a bin
2345
subdirectory containing the MySQL programs used here. If that
2346
is not true, adjust the command path names accordingly.
2348
If you installed MySQL using MySQL Installer (see Section
2349
2.3.3, "Installing MySQL on Microsoft Windows Using MySQL
2350
Installer"), the default installation directory is C:\Program
2351
Files\MySQL\MySQL Server 5.6:
2352
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.6"
2354
A common installation location for installation from a Zip
2355
package is C:\mysql:
2358
Alternatively, add the bin directory to your PATH environment
2359
variable setting. That enables your command interpreter to
2360
find MySQL programs properly, so that you can run a program
2361
by typing only its name, not its path name. See Section
2362
2.3.5.6, "Customizing the PATH for MySQL Tools."
2364
With the server running, issue the following commands to
2365
verify that you can retrieve information from the server. The
2366
output should be similar to that shown here.
2368
Use mysqlshow to see what databases exist:
2370
+--------------------+
2372
+--------------------+
2373
| information_schema |
2376
+--------------------+
2378
The list of installed databases may vary, but will always
2379
include the minimum of mysql and information_schema.
2381
The preceding command (and commands for other MySQL programs
2382
such as mysql) may not work if the correct MySQL account does
2383
not exist. For example, the program may fail with an error,
2384
or you may not be able to view all databases. If you
2385
installed MySQL using MySQL Installer, the root user will
2386
have been created automatically with the password you
2387
supplied. In this case, you should use the -u root and -p
2388
options. (You must use those options if you have already
2389
secured the initial MySQL accounts.) With -p, the client
2390
program prompts for the root password. For example:
2391
C:\> bin\mysqlshow -u root -p
2392
Enter password: (enter root password here)
2393
+--------------------+
2395
+--------------------+
2396
| information_schema |
2399
+--------------------+
2401
If you specify a database name, mysqlshow displays a list of
2402
the tables within the database:
2403
C:\> bin\mysqlshow mysql
2405
+---------------------------+
2407
+---------------------------+
2423
| time_zone_leap_second |
2425
| time_zone_transition |
2426
| time_zone_transition_type |
2428
+---------------------------+
2430
Use the mysql program to select information from a table in
2432
C:\> bin\mysql -e "SELECT User, Host FROM mysql.user" mysql
2433
+------+-----------+
2435
+------+-----------+
2436
| root | localhost |
2437
+------+-----------+
2439
For more information about mysqlshow and mysql, see Section
2440
4.5.6, "mysqlshow --- Display Database, Table, and Column
2441
Information," and Section 4.5.1, "mysql --- The MySQL
2444
2.3.8 Upgrading MySQL on Windows
2297
2446
To upgrade MySQL on Windows, follow these steps:
2383
2532
11. If you encounter errors, see Section 2.3.6,
2384
2533
"Troubleshooting a Microsoft Windows MySQL Server
2387
2.3.8 Windows Postinstallation Procedures
2389
GUI tools exist that perform most of the tasks described
2392
* MySQL Installer: Used to install and upgrade MySQL
2395
* MySQL Workbench: Manages the MySQL server and edits SQL
2398
* MySQL Notifier: Starts, stops, or restarts the MySQL
2399
server, and monitors its status.
2402
(http://dev.mysql.com/doc/mysql-for-excel/en/index.html):
2403
Edits MySQL data with Microsoft Excel.
2405
On Windows, you need not create the data directory and the
2406
grant tables. MySQL Windows distributions include the grant
2407
tables with a set of preinitialized accounts in the mysql
2408
database under the data directory. Regarding passwords, if
2409
you installed MySQL using the MySQL Installer, you may have
2410
already assigned passwords to the accounts. (See Section
2411
2.3.3, "Installing MySQL on Microsoft Windows Using MySQL
2412
Installer.") Otherwise, use the password-assignment procedure
2413
given in Section 2.10.2, "Securing the Initial MySQL
2416
Before setting up passwords, you might want to try running
2417
some client programs to make sure that you can connect to the
2418
server and that it is operating properly. Make sure that the
2419
server is running (see Section 2.3.5.4, "Starting the Server
2420
for the First Time"), and then issue the following commands
2421
to verify that you can retrieve information from the server.
2422
You may need to specify directory different from C:\mysql\bin
2423
on the command line. If you installed MySQL using MySQL
2424
Installer, the default directory is C:\Program
2425
Files\MySQL\MySQL Server 5.6, and the mysql and mysqlshow
2426
client programs are in C:\Program Files\MySQL\MySQL Server
2427
5.6\bin. See Section 2.3.3, "Installing MySQL on Microsoft
2428
Windows Using MySQL Installer," for more information.
2430
Use mysqlshow to see what databases exist:
2431
C:\> C:\mysql\bin\mysqlshow
2432
+--------------------+
2434
+--------------------+
2435
| information_schema |
2438
+--------------------+
2440
The list of installed databases may vary, but will always
2441
include the minimum of mysql and information_schema. In most
2442
cases, the test database will also be installed
2445
The preceding command (and commands for other MySQL programs
2446
such as mysql) may not work if the correct MySQL account does
2447
not exist. For example, the program may fail with an error,
2448
or you may not be able to view all databases. If you
2449
installed MySQL using MySQL Installer, then the root user
2450
will have been created automatically with the password you
2451
supplied. In this case, you should use the -u root and -p
2452
options. (You will also need to use the -u root and -p
2453
options if you have already secured the initial MySQL
2454
accounts.) With -p, you will be prompted for the root
2455
password. For example:
2456
C:\> C:\mysql\bin\mysqlshow -u root -p
2457
Enter password: (enter root password here)
2458
+--------------------+
2460
+--------------------+
2461
| information_schema |
2464
+--------------------+
2466
If you specify a database name, mysqlshow displays a list of
2467
the tables within the database:
2468
C:\> C:\mysql\bin\mysqlshow mysql
2470
+---------------------------+
2472
+---------------------------+
2488
| time_zone_leap_second |
2490
| time_zone_transition |
2491
| time_zone_transition_type |
2493
+---------------------------+
2495
Use the mysql program to select information from a table in
2497
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db"
2498
+------+--------+------+
2499
| host | db | user |
2500
+------+--------+------+
2503
+------+--------+------+
2505
For more information about mysqlshow and mysql, see Section
2506
4.5.6, "mysqlshow --- Display Database, Table, and Column
2507
Information," and Section 4.5.1, "mysql --- The MySQL
2510
If you are running a version of Windows that supports
2511
services, you can set up the MySQL server to run
2512
automatically when Windows starts. See Section 2.3.5.7,
2513
"Starting MySQL as a Windows Service."