1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755
|
2.2. Installing MySQL on Unix/Linux Using Generic Binaries
Oracle provides a set of binary distributions of MySQL. These
include binary distributions in the form of compressed tar files
(files with a .tar.gz extension) for a number of platforms, as
well as binaries in platform-specific package formats for selected
platforms.
This section covers the installation of MySQL from a compressed
tar file binary distribution. For other platform-specific package
formats, see the other platform-specific sections. For example,
for Windows distributions, see Section 2.3, "Installing MySQL on
Microsoft Windows."
To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
MySQL compressed tar file binary distributions have names of the
form mysql-VERSION-OS.tar.gz, where VERSION is a number (for
example, 5.1.74), and OS indicates the type of operating system
for which the distribution is intended (for example, pc-linux-i686
or winx64).
To install MySQL from a compressed tar file binary distribution,
your system must have GNU gunzip to uncompress the distribution
and a reasonable tar to unpack it. If your tar program supports
the z option, it can both uncompress and unpack the file.
GNU tar is known to work. The standard tar provided with some
operating systems is not able to unpack the long file names in the
MySQL distribution. You should download and install GNU tar, or if
available, use a preinstalled version of GNU tar. Usually this is
available as gnutar, gtar, or as tar within a GNU or Free Software
directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is
available from http://www.gnu.org/software/tar/.
Warning
If you have previously installed MySQL using your operating system
native package management system, such as yum or apt-get, you may
experience problems installing using a native binary. Make sure
your previous MySQL previous installation has been removed
entirely (using your package management system), and that any
additional files, such as old versions of your data files, have
also been removed. You should also check the existence of
configuration files such as /etc/my.cnf or the /etc/mysql
directory have been deleted.
If you run into problems and need to file a bug report, please use
the instructions in Section 1.7, "How to Report Bugs or Problems."
On Unix, to install a compressed tar file binary distribution,
unpack it at the installation location you choose (typically
/usr/local/mysql). This creates the directories shown in the
following table.
Table 2.3. MySQL Installation Layout for Generic Unix/Linux Binary
Package
Directory Contents of Directory
bin Client programs and the mysqld server
data Log files, databases
docs Manual in Info format
man Unix manual pages
include Include (header) files
lib Libraries
scripts mysql_install_db
share Miscellaneous support files, including error messages,
sample configuration files, SQL for database installation
sql-bench Benchmarks
Debug versions of the mysqld binary are available as mysqld-debug.
To compile your own debug version of MySQL from a source
distribution, use the appropriate configuration options to enable
debugging support. For more information on compiling from source,
see Section 2.11, "Installing MySQL from Source."
To install and use a MySQL binary distribution, the basic command
sequence looks like this:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
A more detailed version of the preceding description for
installing a binary distribution follows.
Note
This procedure assumes that you have root (administrator) access
to your system. Alternatively, you can prefix each command using
the sudo (Linux) or pfexec (OpenSolaris) command.
The procedure does not set up any passwords for MySQL accounts.
After following the procedure, proceed to Section 2.12.2,
"Securing the Initial MySQL Accounts."
Create a mysql User and Group
If your system does not already have a user and group for mysqld
to run as, you may need to create one. The following commands add
the mysql group and the mysql user. You might want to call the
user and group something else instead of mysql. If so, substitute
the appropriate name in the following instructions. The syntax for
useradd and groupadd may differ slightly on different versions of
Unix, or they may have different names such as adduser and
addgroup.
shell> groupadd mysql
shell> useradd -r -g mysql mysql
Note
Because the user is required only for ownership purposes, not
login purposes, the useradd command uses the -r option to create a
user that does not have login permissions to your server host.
Omit this option to permit logins for the user (or if your useradd
does not support the option).
Obtain and Unpack the Distribution
Pick the directory under which you want to unpack the distribution
and change location into it. The example here unpacks the
distribution under /usr/local. The instructions, therefore, assume
that you have permission to create files and directories in
/usr/local. If that directory is protected, you must perform the
installation as root.
shell> cd /usr/local
Obtain a distribution file using the instructions in Section
2.1.3, "How to Get MySQL." For a given release, binary
distributions for all platforms are built from the same MySQL
source distribution.
Unpack the distribution, which creates the installation directory.
Then create a symbolic link to that directory. tar can uncompress
and unpack the distribution if it has z option support:
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
The tar command creates a directory named mysql-VERSION-OS. The ln
command makes a symbolic link to that directory. This enables you
to refer more easily to the installation directory as
/usr/local/mysql.
If your tar does not have z option support, use gunzip to unpack
the distribution and tar to unpack it. Replace the preceding tar
command with the following alternative command to uncompress and
extract the distribution:
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
Perform Postinstallation Setup
The remainder of the installation process involves setting up the
configuration file, creating the core databases, and starting the
MySQL server. For next steps, see Section 2.12, "Postinstallation
Setup and Testing."
Note
The accounts that are listed in the MySQL grant tables initially
have no passwords. After starting the server, you should set up
passwords for them using the instructions in Section 2.12.2,
"Securing the Initial MySQL Accounts."
Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights
reserved. Legal Notices
2.3. Installing MySQL on Microsoft Windows
MySQL for Microsoft Windows is available in a number of different
forms. A Microsoft Windows operating system such as Windows 2000,
Windows XP, Windows Vista, Windows 7, Windows Server 2003, or
Windows Server 2008. Both 32-bit and 64-bit versions are
supported. For supported platform information, see
http://www.mysql.com/support/supportedplatforms/database.html.
In addition to running MySQL as a standard application, you can
also run the MySQL server as a Windows service. By using a service
you can monitor and control the operation of the server through
the standard Windows service management tools. For more
information, see Section 2.3.6.7, "Starting MySQL Server as a
Microsoft Windows Service."
Generally, you should install MySQL on Windows using an account
that has administrator rights. Otherwise, you may encounter
problems with certain operations such as editing the PATH
environment variable or accessing the Service Control Manager.
Once installed, MySQL does not need to be executed using a user
with Administrator privileges.
For a list of limitations within the Windows version of MySQL, see
Section E.7.6, "Windows Platform Limitations."
In addition to the MySQL Server package, you may need or want
additional components to use MySQL with your application or
development environment. These include, but are not limited to:
* If you plan to connect to the MySQL server using ODBC, you
need a Connector/ODBC driver. For more information, including
installation and configuration instructions, see Section 21.1,
"MySQL Connector/ODBC."
* If you plan to use MySQL server with .NET applications, you
need the Connector/Net driver. For more information, including
installation and configuration instructions, see Section 21.2,
"MySQL Connector/Net."
MySQL distributions for Windows can be downloaded from
http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
MySQL."
MySQL for Windows is available in several distribution formats,
detailed below. Generally speaking, you should use a binary
distribution that includes an installer. It is simpler to use than
the others, and you need no additional tools to get MySQL up and
running. The installer for the Windows version of MySQL, combined
with a GUI Config Wizard, automatically installs MySQL, creates an
option file, starts the server, and secures the default user
accounts.
* Binary installer distribution. The installable distribution
comes packaged as a Microsoft Windows Installer (MSI) package
that you can install manually or automatically on your
systems. Two formats are available, an essentials package that
contains all the files you need to install and configure
MySQL, but no additional components, and a complete package
that includes MySQL, configuration tools, benchmarks and other
components. For more information on the specific differences,
see Section 2.3.2, "Choosing the Installation Package for
Microsoft Windows"
For instructions on installing MySQL using one of the MSI
installation packages, see Section 2.3.3, "Installing MySQL on
Microsoft Windows Using an MSI Package."
* Standard binary distribution format packaged as a Zip file
containing all of the necessary files that you unpack into
your chosen location. This package contains all of the files
in the full Windows MSI Installer package, but does not
include an installation program.
For instructions on installing MySQL using the Zip file, see
Section 2.3.6, "Installing MySQL on Microsoft Windows Using a
noinstall Zip Archive."
* The source distribution contains all the code and support
files for building the executables using the Visual Studio
compiler system.
For instructions on building MySQL from source on Windows, see
Section 2.11.7, "Installing MySQL from Source on Windows."
MySQL on Windows considerations:
* Large Table Support
If you need tables with a size larger than 4GB, install MySQL
on an NTFS or newer file system. Do not forget to use MAX_ROWS
and AVG_ROW_LENGTH when you create tables. See Section
13.1.17, "CREATE TABLE Syntax."
* MySQL and Virus Checking Software
Using virus scanning software such as Norton/Symantec
Anti-Virus on directories containing MySQL data and temporary
tables can cause issues, both in terms of the performance of
MySQL and the virus-scanning software mis-identifying the
contents of the files as containing spam. This is because of
the fingerprinting mechanism used by the virus scanning
software, and the way in which MySQL rapidly updates different
files, which may be identified as a potential security risk.
After installing MySQL Server, it is recommended that you
disable virus scanning on the main directory (datadir) being
used to store your MySQL table data. There is usually a system
built into the virus scanning software to permit certain
directories to be specifically ignored during virus scanning.
In addition, by default, MySQL creates temporary files in the
standard Windows temporary directory. To prevent the temporary
files also being scanned, you should configure a separate
temporary directory for MySQL temporary files and add this to
the virus scanning exclusion list. To do this, add a
configuration option for the tmpdir parameter to your my.ini
configuration file. For more information, see Section 2.3.6.2,
"Creating an Option File."
2.3.1. MySQL Installation Layout on Microsoft Windows
For MySQL 5.1 on Windows, the default installation directory is
C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
to install in C:\mysql, the directory that formerly was used as
the default. However, the layout of the subdirectories remains the
same.
For MySQL 5.1.23 and earlier, all of the files are located within
the parent directory, using the structure shown in the following
table.
Table 2.4. Installation Layout for Windows Using MySQL 5.1.23 and
Earlier
Directory Contents of Directory
bin Client programs and the mysqld server
data Log files, databases
examples Example programs and scripts
include Include (header) files
lib Libraries
scripts Utility scripts
share Miscellaneous support files, including error messages,
character set files, sample configuration files, SQL for database
installation
For MySQL 5.1.24 and later, the default location of data directory
was changed. The remainder of the directory structure remains the
same.
Table 2.5. Installation Layout for Microsoft Windows using MySQL
5.1.24 and later
Directory Contents of Directory Notes
bin Client programs and the mysqld server
%ALLUSERSPROFILE%\MySQL\MySQL Server 5.1\ Log files, databases
(Windows XP, Windows Server 2003) The Windows system variable
%ALLUSERSPROFILE% defaults to C:\Documents and Settings\All
Users\Application Data
%PROGRAMDATA%\MySQL\MySQL Server 5.1\ Log files, databases (Vista,
Windows 7, Windows Server 2008, and newer) The Windows system
variable %PROGRAMDATA% defaults to C:\ProgramData
examples Example programs and scripts
include Include (header) files
lib Libraries
scripts Utility scripts
share Miscellaneous support files, including error messages,
character set files, sample configuration files, SQL for database
installation
2.3.2. Choosing the Installation Package for Microsoft Windows
For MySQL 5.1, there are three installation package formats to
choose from when installing MySQL on Windows:
Note
Using MySQL Installer is the recommended installation method for
Microsoft Windows users. The MySQL Server 5.1 release does not
include its own MySQL Installer release, but a MySQL Installer
version 5.5 and above can optionally install MySQL Server 5.1.
Follow the standard Installing MySQL on Microsoft Windows Using
MySQL Installer
(http://dev.mysql.com/doc/refman/5.5/en/mysql-installer.html)
documentation but choose Custom Install after executing it. A
MySQL Server 5.1 option will be available, and choosing it will
cause MySQL Installer to download it for you.
Table 2.6. Microsoft Windows MySQL Installation package comparison
Packaging
Feature Essentials Complete Zip (No-install)
Installer Yes Yes No
Directory-only
MySQL Server Instance Config Wizard Yes Yes No
Test Suite No Yes Yes
MySQL Server Yes Yes Yes
MySQL Client Programs Yes Yes Yes
C Headers/Libraries Yes Yes Yes
Embedded Server No Optional Yes
Scripts and Examples No Optional Yes
In the above table:
* Yes indicates that the component is installed by default.
* No indicates that the component is not installed or included.
* Optional indicates that the component is included with the
package, but not installed unless explicitly requested using
the Custom installation mode.
The workflow for installing using the MSI installer is shown
below:
Figure 2.7. Installation Workflow for Windows Using MSI
Installation Workflow for Windows using MSI
The workflow for installing using the MSI installer is shown
below:
Figure 2.8. Installation Workflow for Windows Using Zip
Installation Workflow for Windows using Zip
Note
For the Essentials and Complete packages in the MSI installer, you
can select individual components to be installed by using the
Custom mode, including disable the components confiurated for
installation by default.
Full details on the components are suggested uses are provided
below for reference:
* Windows Essentials: This package has a file name similar to
mysql-essential-5.1.74-win32.msi and is supplied as a
Microsoft Installer (MSI) package. The package includes the
minimum set of files needed to install MySQL on Windows,
including the MySQL Server Instance Config Wizard. This
package does not include optional components such as the
embedded server, developer headers and libraries or benchmark
suite.
To install using this package, see Section 2.3.3, "Installing
MySQL on Microsoft Windows Using an MSI Package."
* Windows MSI Installer (Complete): This package has a file name
similar to mysql-5.1.74-win32.msi and contains all files
needed for a complete Windows installation, including the
MySQL Server Instance Config Wizard. This package includes
optional components such as the embedded server and benchmark
suite.
To install using this package, see Section 2.3.3, "Installing
MySQL on Microsoft Windows Using an MSI Package."
* Without installer: This package has a file name similar to
mysql-noinstall-5.1.74-win32.zip and contains all the files
found in the Complete install package, with the exception of
the MySQL Server Instance Config Wizard. This package does not
include an automated installer, and must be manually installed
and configured.
The Essentials package is recommended for most users. Both the
Essentials and Complete distributions are available as an .msi
file for use with the Windows Installer. The Noinstall
distribution is packaged as a Zip archive. To use a Zip archive,
you must have a tool that can unpack .zip files.
When using the MSI installers you can automate the installation
process. For more information, see Section 2.3.3.2, "Automating
MySQL Installation on Microsoft Windows Using the MSI Package." To
automate the creation of a MySQL instance, see Section 2.3.5.13,
"MySQL Server Instance Config Wizard: Creating an Instance from
the Command Line."
Your choice of install package affects the installation process
you must follow. If you choose to install either an Essentials or
Complete install package, see Section 2.3.3, "Installing MySQL on
Microsoft Windows Using an MSI Package." If you choose to install
a Noinstall archive, see Section 2.3.6, "Installing MySQL on
Microsoft Windows Using a noinstall Zip Archive."
2.3.3. Installing MySQL on Microsoft Windows Using an MSI Package
The MSI package is designed to install and configure MySQL in such
a way that you can immediately get started using MySQL.
The MySQL Installation Wizard and MySQL Configuration Wizard are
available in the Essentials and Complete install packages. They
are recommended for most standard MySQL installations. Exceptions
include users who need to install multiple instances of MySQL on a
single server host and advanced users who want complete control of
server configuration.
* For information on installing using the GUI MSI installer
process, see Section 2.3.3.1, "Using the MySQL Installation
Wizard for Microsoft Windows."
* For information on installing using the command line using the
MSI package, see Section 2.3.3.2, "Automating MySQL
Installation on Microsoft Windows Using the MSI Package."
* If you have previously installed MySQL using the MSI package
and want to remove MySQL, see Section 2.3.3.3, "Removing MySQL
When Installed from the MSI Package."
The workflow sequence for using the installer is shown in the
figure below:
Figure 2.9. Installation Workflow for Windows Using MSI Installer
Installation Workflow for Windows using MSI Installer
Note
Microsoft Windows XP and later include a firewall which
specifically blocks ports. If you plan on using MySQL through a
network port then you should open and create an exception for this
port before performing the installation. To check and if necessary
add an exception to the firewall settings:
1. First ensure that you are logged in as an Administrator or a
user with Administrator privileges.
2. Go to the Control Panel, and double click the Windows Firewall
icon.
3. Choose the Allow a program through Windows Firewall option and
click the Add port button.
4. Enter MySQL into the Name text box and 3306 (or the port of
your choice) into the Port number text box.
5. Also ensure that the TCP protocol radio button is selected.
6. If you wish, you can also limit access to the MySQL server by
choosing the Change scope button.
7. Confirm your choices by clicking the OK button.
Additionally, when running the MySQL Installation Wizard on
Windows Vista or newer, ensure that you are logged in as a user
with administrative rights.
Note
When using Windows Vista or newer, you may want to disable User
Account Control (UAC) before performing the installation. If you
do not do so, then MySQL may be identified as a security risk,
which will mean that you need to enable MySQL. You can disable the
security checking by following these instructions:
1. Open Control Panel.
2. Under the User Accounts and Family Safety, select Add or
remove user accounts.
3. Click the Got to the main User Accounts page link.
4. Click on Turn User Account Control on or off. You may be
prompted to provide permission to change this setting. Click
Continue.
5. Deselect or uncheck the check box next to Use User Account
Control (UAC) to help protect your computer. Click OK to save
the setting.
You will need to restart to complete the process. Click Restart
Now to reboot the machine and apply the changes. You can then
follow the instructions below for installing Windows.
2.3.3.1. Using the MySQL Installation Wizard for Microsoft Windows
MySQL Installation Wizard is an installer for the MySQL server
that uses the latest installer technologies for Microsoft Windows.
The MySQL Installation Wizard, in combination with the MySQL
Config Wizard, enables a user to install and configure a MySQL
server that is ready for use immediately after installation.
The MySQL Installation Wizard uses the standard Microsoft
Installer Engine (MSI) system is the standard installer for all
MySQL server distributions. See Section 2.3.3.1.6, "MySQL
Installation Wizard: Upgrading MySQL," for more information on
upgrading from a previous version.
If you are upgrading an installation from MySQL 5.1.31 or earlier
to MySQL 5.1.32 or later, read the notes provided in Section
2.3.3.1.6, "MySQL Installation Wizard: Upgrading MySQL."
The Microsoft Windows Installer Engine was updated with the
release of Windows XP; those using a previous version of Windows
can reference this Microsoft Knowledge Base article
(http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
for information on upgrading to the latest version of the Windows
Installer Engine.
In addition, Microsoft has introduced the WiX (Windows Installer
XML) toolkit. This is the first highly acknowledged Open Source
project from Microsoft. We have switched to WiX because it is an
Open Source project and it enables us to handle the complete
Windows installation process in a flexible manner using scripts.
Improving the MySQL Installation Wizard depends on the support and
feedback of users like you. If you find that the MySQL
Installation Wizard is lacking some feature important to you, or
if you discover a bug, please report it in our bugs database using
the instructions given in Section 1.7, "How to Report Bugs or
Problems."
2.3.3.1.1. MySQL Installation Wizard: Downloading and Starting
The MySQL installation packages can be downloaded from
http://dev.mysql.com/downloads/. If the package you download is
contained within a Zip archive, you need to extract the archive
first.
The process for starting the wizard depends on the contents of the
installation package you download. If there is a setup.exe file
present, double-click it to start the installation process. If
there is an .msi file present, double-click it to start the
installation process.
2.3.3.1.2. MySQL Installation Wizard: Choosing an Install Type
There are three installation types available: Typical, Complete,
and Custom.
The Typical installation type installs the MySQL server, the mysql
command-line client, and the command-line utilities. The
command-line clients and utilities include mysqldump, myisamchk,
and several other tools to help you manage the MySQL server.
The Complete installation type installs all components included in
the installation package. The full installation package includes
components such as the embedded server library, the benchmark
suite, support scripts, and documentation.
The Custom installation type gives you complete control over which
packages you wish to install and the installation path that is
used. See Section 2.3.3.1.3, "MySQL Installation Wizard: The
Custom Install Dialog," for more information on performing a
custom install.
If you choose the Typical or Complete installation types and click
the Next button, you advance to the confirmation screen to verify
your choices and begin the installation. If you choose the Custom
installation type and click the Next button, you advance to the
custom installation dialog, described in Section 2.3.3.1.3, "MySQL
Installation Wizard: The Custom Install Dialog."
2.3.3.1.3. MySQL Installation Wizard: The Custom Install Dialog
If you wish to change the installation path or the specific
components that are installed by the MySQL Installation Wizard,
choose the Custom installation type.
A tree view on the left side of the custom install dialog lists
all available components. Components that are not installed have a
red X icon; components that are installed have a gray icon. To
change whether a component is installed, click that component's
icon and choose a new option from the drop-down list that appears.
You can change the default installation path by clicking the
Change... button to the right of the displayed installation path.
After choosing your installation components and installation path,
click the Next button to advance to the confirmation dialog.
2.3.3.1.4. MySQL Installation Wizard: The Confirmation Dialog
Once you choose an installation type and optionally choose your
installation components, you advance to the confirmation dialog.
Your installation type and installation path are displayed for you
to review.
To install MySQL if you are satisfied with your settings, click
the Install button. To change your settings, click the Back
button. To exit the MySQL Installation Wizard without installing
MySQL, click the Cancel button.
In MySQL 5.1.47 and earlier, after installation is complete, you
have the option of registering with the MySQL web site.
Registration gives you access to post in the MySQL forums at
forums.mysql.com (http://forums.mysql.com), along with the ability
to report bugs at bugs.mysql.com (http://bugs.mysql.com) and to
subscribe to our newsletter.
The final screen of the installer provides a summary of the
installation and gives you the option to launch the MySQL Config
Wizard, which you can use to create a configuration file, install
the MySQL service, and configure security settings.
2.3.3.1.5. MySQL Installation Wizard: Changes Made
Once you click the Install button, the MySQL Installation Wizard
begins the installation process and makes certain changes to your
system which are described in the sections that follow.
Changes to the Registry
The MySQL Installation Wizard creates one Windows registry key in
a typical install situation, located in
HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB. For 64-bit Windows, the
registry location is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MYSQL
AB. A server version specific entry will be created for each major
version of MySQL that you install.
The MySQL Installation Wizard creates a key named after the major
version of the server that is being installed, such as MySQL
Server 5.1. It contains two string values, Location and Version.
The Location string contains the path to the installation
directory. In a default installation it contains C:\Program
Files\MySQL\MySQL Server 5.1\. The Version string contains the
release number. For example, for an installation of MySQL Server
5.1.74, the key contains a value of 5.1.74.
These registry keys are used to help external tools identify the
installed location of the MySQL server, preventing a complete scan
of the hard-disk to determine the installation path of the MySQL
server. The registry keys are not required to run the server, and
if you install MySQL using the noinstall Zip archive, the registry
keys are not created.
Changes to the Start Menu
The MySQL Installation Wizard creates a new entry in the Windows
Start menu under a common MySQL menu heading named after the major
version of MySQL that you have installed. For example, if you
install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
Server 5.1 section in the Start menu.
The following entries are created within the new Start menu
section:
* MySQL Command-Line Client: This is a shortcut to the mysql
command-line client and is configured to connect as the root
user. The shortcut prompts for a root user password when you
connect.
* MySQL Server Instance Config Wizard: This is a shortcut to the
MySQL Config Wizard. Use this shortcut to configure a newly
installed server, or to reconfigure an existing server.
* MySQL Documentation: This is a link to the MySQL server
documentation that is stored locally in the MySQL server
installation directory. This option is not available when the
MySQL server is installed using the Essentials installation
package.
Changes to the File System
The MySQL Installation Wizard by default installs the MySQL 5.1
server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
Files is the default location for applications in your system, and
5.1 is the major version of your MySQL server. This is the
recommended location for the MySQL server, replacing the former
default location C:\mysql.
By default, all MySQL applications are stored in a common
directory at C:\Program Files\MySQL, where Program Files is the
default location for applications in your Windows installation. A
typical MySQL installation on a developer machine might look like
this:
C:\Program Files\MySQL\MySQL Server 5.1
C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
This approach makes it easier to manage and maintain all MySQL
applications installed on a particular system.
In MySQL 5.1.23 and earlier, the default location for the data
files used by MySQL is located within the corresponding MySQL
Server installation directory. For MySQL 5.1.24 and later, the
default location of the data directory is the AppData directory
configured for the user that installed the MySQL application.
2.3.3.1.6. MySQL Installation Wizard: Upgrading MySQL
The MySQL Installation Wizard can perform server upgrades
automatically using the upgrade capabilities of MSI. That means
you do not need to remove a previous installation manually before
installing a new release. The installer automatically shuts down
and removes the previous MySQL service before installing the new
version.
Automatic upgrades are available only when upgrading between
installations that have the same major and minor version numbers.
For example, you can upgrade automatically from MySQL 5.1.5 to
MySQL 5.1.6, but not from MySQL 5.0 to MySQL 5.1.
In MySQL 5.1.32 and later, the EXE version of the MSI installer
packages were removed. When upgrading an existing MySQL
installation from the old EXE based installer to the MSI based
installer, please keep the following notes in mind:
* The MSI installer will not identify an existing installation
that was installed using the old EXE installer. This means
that the installer will not stop the existing server, or
detect that the existing password is required before
installing the new version. To work around this:
1. Stop the current server manually using net stop or
mysqladmin shutdown.
2. Remove the existing installation manually by using the
Add/Remove Programs control panel. This will keep the
existing configuration and data files, as these are not
removed automatically.
3. Install the new version of MySQL using the MSI installer.
When running the installation, skip updating the security
by deselecting the check box on the security screen.
4. Complete the installation, and then start the server
again. You should be able to login with your existing
user and password credentials.
* You can only upgrade the version and release using the MSI
installer. For example, you can upgrade an open source
installation with an open source installer. You cannot upgrade
an open source installation using the enterprise installer.
See Section 2.3.8, "Upgrading MySQL Server on Microsoft Windows."
2.3.3.2. Automating MySQL Installation on Microsoft Windows Using the
MSI Package
The Microsoft Installer (MSI) supports a both a quiet and a
passive mode that can be used to install MySQL automatically
without requiring intervention. You can use this either in scripts
to automatically install MySQL or through a terminal connection
such as Telnet where you do not have access to the standard
Windows user interface. The MSI packages can also be used in
combination with Microsoft's Group Policy system (part of Windows
Server 2003 and Windows Server 2008) to install MySQL across
multiple machines.
To install MySQL from one of the MSI packages automatically from
the command line (or within a script), you need to use the
msiexec.exe tool. For example, to perform a quiet installation
(which shows no dialog boxes or progress):
shell> msiexec /i mysql-5.1.74.msi /quiet
The /i indicates that you want to perform an installation. The
/quiet option indicates that you want no interactive elements.
To provide a dialog box showing the progress during installation,
and the dialog boxes providing information on the installation and
registration of MySQL, use /passive mode instead of /quiet:
shell> msiexec /i mysql-5.1.74.msi /passive
Regardless of the mode of the installation, installing the package
in this manner performs a 'Typical' installation, and installs the
default components into the standard location.
You can also use this method to uninstall MySQL by using the
/uninstall or /x options:
shell> msiexec /x mysql-5.1.74.msi /uninstall
To install MySQL and configure a MySQL instance from the command
line, see Section 2.3.5.13, "MySQL Server Instance Config Wizard:
Creating an Instance from the Command Line."
For information on using MSI packages to install software
automatically using Group Policy, see How to use Group Policy to
remotely install software in Windows Server 2003
(http://support.microsoft.com/kb/816102).
2.3.3.3. Removing MySQL When Installed from the MSI Package
To uninstall a MySQL where you have used the MSI packages, you
must use the Add/Remove Programs tool within Control Panel. To do
this:
1. Right-click the start menu and choose Control Panel.
2. If the Control Panel is set to category mode (you will see
Pick a category at the top of the Control Panel window),
double-click Add or Remove Programs. If the Control is set to
classic mode, double-click the Add or Remove Programs icon.
3. Find MySQL in the list of installed software. MySQL Server is
installed against major version numbers (MySQL 5.0, MySQL 5.1,
etc.). Select the version that you want to remove and click
Remove.
4. You will be prompted to confirm the removal. Click Yes to
remove MySQL.
When MySQL is removed using this method, only the installed
components are removed. Any database information (including the
tables and data), import or export files, log files, and binary
logs produced during execution are kept in their configured
location.
If you try to install MySQL again the information will be retained
and you will be prompted to enter the password configured with the
original installation.
If you want to delete MySQL completely:
* Delete the associated data directory. On Windows XP and
Windows Server 2003, before MySQL 5.1.24, the default data
directory would be located within the MySQL installation
directory. On MySQL 5.1.24 and later, the default data
directory is the configured AppData directory, which is
C:\Documents and Settings\All Users\Application Data\MySQL by
default.
* On Windows 7 and Windows Server 2008, the default data
directory location is C:\ProgramData\Mysql.
Note
The C:\ProgramData directory is hidden by default. You must
change your folder options to view the hidden file. Choose
Organize, Folder and search options, Show hidden folders.
2.3.4. MySQL Notifier for Microsoft Windows
The MySQL Notifier for Microsoft Windows is a tool that enables
you to monitor and adjust the status of your local and remote
MySQL Server instances through an indicator that resides in the
system tray. The MySQL Notifier for Microsoft Windows also gives
quick access to several MySQL GUI tools (such as MySQL Workbench)
through its context menu.
The MySQL Notifier for Microsoft Windows is installed by MySQL
Installer, and (by default) will start-up when Microsoft Windows
is started.
Note
To install, download and execute the MySQL Installer
(http://dev.mysql.com/downloads/installer/), be sure the MySQL
Notifier for Microsoft Windows product is selected, then proceed
with the installation. See the MySQL Installer manual
(http://dev.mysql.com/doc/refman/5.5/en/mysql-installer.html) for
additional details.
For release notes detailing the changes in each release of MySQL
Notifier for Microsoft Windows, see the MySQL Notifier Release
Notes (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/).
Visit the MySQL Notifier forum
(http://forums.mysql.com/list.php?173) for additional MySQL
Notifier for Microsoft Windows help and support.
Features include:
* Start, Stop, and Restart instances of the MySQL Server.
* Automatically detects (and adds) new MySQL Server services.
These are listed under Manage Monitored Items, and may also be
configured.
* The Tray icon changes, depending on the status. It's green if
all monitored MySQL Server instances are running, or red if at
least one service is stopped. The Update MySQL Notifier tray
icon based on service status option, which dictates this
behavior, is enabled by default for each service.
* Links to other applications like MySQL Workbench, MySQL
Installer, and the MySQL Utilities. For example, choosing
Configure Instance will load the MySQL Workbench Server
Administration window for that particular instance.
* If MySQL Workbench is also installed, then the Configure
Instance and SQL Editor options are available for local (but
not remote) MySQL instances.
* Monitoring of both local and remote MySQL instances.
Note
Remote monitoring is available since MySQL Notifier for Microsoft
Windows 1.1.0.
The MySQL Notifier for Microsoft Windows resides in the system
tray and provides visual status information for your MySQL Server
instances. A green icon is displayed at the top left corner of the
tray icon if the current MySQL Server is running, or a red icon if
the service is stopped.
The MySQL Notifier for Microsoft Windows automatically adds
discovered MySQL Services on the local machine, and each service
is saved and configurable. By default, the Automatically add new
services whose name contains option is enabled and set to mysql.
Related Notifications Options include being notified when new
services are either discovered or experience status changes, and
are also enabled by default. And uninstalling a service will also
remove the service from the MySQL Notifier for Microsoft Windows.
Note
The Automatically add new services whose name contains option
default changed from ".*mysqld.*" to "mysql" in Notifier 1.1.0.
Clicking the system tray icon will reveal several options, as seen
in the screenshots below:
The Service Instance menu is the main MySQL Notifier for Microsoft
Windows window, and enables you to Stop, Start, and Restart the
MySQL Server.
Figure 2.10. MySQL Notifier for Microsoft Windows Service Instance
menu
MySQL Notifier for Microsoft Windows Service Instance menu
The Actions menu includes several links to external applications
(if they are installed), and a a Refresh Status option to manually
refresh the status of all monitored services (in both local and
remote computers) and MySQL instances.
Note
The main menu will not show the Actions menu when there are no
services being monitored by MySQL Notifier for Microsoft Windows.
Note
The Refresh Status feature is available since MySQL Notifier for
Microsoft Windows 1.1.0.
Figure 2.11. MySQL Notifier for Microsoft Windows Actions menu
MySQL Notifier for Microsoft Windows Actions menu
The Actions, Options menu configures MySQL Notifier for Microsoft
Windows and includes options to:
* Use colorful status icons: Enables a colorful style of icons
for the tray of the MySQL Notifier for Microsoft Windows.
* Run at Windows Startup: Allows the application to be loaded
when Microsoft Windows starts.
* Automatically Check For Updates Every # Weeks: Checks for a
new version of MySQL Notifier for Microsoft Windows, and runs
this check every # weeks.
* Automatically add new services whose name contains: The text
used to filter services and add them automatically to the
monitored list of the local computer running MySQL Notifier,
and on remote computers already monitoring Windows services.
monitored services, and also filters the list of the Microsoft
Windows services for the Add New Service dialog.
Prior to version 1.1.0, this option was named "Automatically
add new services that match this pattern."
* Notify me when a service is automatically added: Will display
a balloon notification from the taskbar when a newly
discovered service is added to the monitored services list.
* Notify me when a service changes status: Will display a
balloon notification from the taskbar when a monitored service
changes its status.
Figure 2.12. MySQL Notifier for Microsoft Windows Options menu
MySQL Notifier for Microsoft Windows Options menu
The Actions, Manage Monitored Items menu enables you to configure
the monitored services and MySQL instances. First, with the
Services tab open:
Figure 2.13. MySQL Notifier for Microsoft Windows Manage Services
menu
MySQL Notifier for Microsoft Windows Manage Services menu
The Instances tab is similar:
Figure 2.14. MySQL Notifier for Microsoft Windows Manage Instances
menu
MySQL Notifier for Microsoft Windows Manage Instances menu
Adding a service or instance (after clicking Add in the Manage
Monitored Items window) enables you to select a running Microsoft
Windows service or instance connection, and configure MySQL
Notifier for Microsoft Windows to monitor it. Add a new service or
instance by clicking service name from the list, then OK to
accept. Multiple services and instances may be selected.
Figure 2.15. MySQL Notifier for Microsoft Windows Adding new
services
MySQL Notifier for Microsoft Windows Adding new services
And instances:
Figure 2.16. MySQL Notifier for Microsoft Windows Adding new
instances
MySQL Notifier for Microsoft Windows Adding new instances
Note
The Instances tab available since MySQL Notifier for Microsoft
Windows 1.1.0.
2.3.4.1. Remote monitoring set up and installation instructions
The MySQL Notifier for Microsoft Windows uses Windows Management
Instrumentation (WMI) to manage and monitor services in remote
computers running Windows XP or later. This guide explains how it
works, and how to set up your system to monitor remote MySQL
instances.
Note
Remote monitoring is available since MySQL Notifier for Microsoft
Windows 1.1.0.
In order to configure WMI, it is important to understand that the
underlying Distributed Component Object Model (DCOM) architecture
is doing the WMI work. Specifically, MySQL Notifier for Microsoft
Windows is using asynchronous notification queries on remote
Microsoft Windows hosts as .NET events. These events send an
asynchronous callback to the computer running the MySQL Notifier
for Microsoft Windows so it knows when a service status has
changed on the remote computer. Asynchronous notifications offer
the best performance compared to semi-synchronous notifications or
synchronous notifications that use timers.
Asynchronous notifications requires the remote computer to send a
callback to the client computer (thus opening a reverse
connection), so the Windows Firewall and DCOM settings must be
properly configured for the communication to function properly.
Figure 2.17. MySQL Notifier for Microsoft Windows Distributed
Component Object Model (DCOM)
MySQL Notifier for Microsoft Windows Distributed Component Object
Model (DCOM)
Most of the common errors thrown by asynchronous WMI notifications
are related to Windows Firewall blocking the communication, or to
DCOM / WMI settings not being set up properly. For a list of
common errors with solutions, see Section 2.3.4.1, "."
The following steps are required to make WMI function. These steps
are divided between two machines. A single host computer that runs
MySQL Notifier for Microsoft Windows (Computer A), and multiple
remote machines that are being monitored (Computer B).
Computer running MySQL Notifier for Microsoft Windows (Computer A)
1. Allow for remote administration by either editing the Group
Policy Editor, or using NETSH:
Using the Group Policy Editor:
a. Click Start, click Run, type GPEDIT.MSC, and then click
OK.
b. Under the Local Computer Policy heading, double-click
Computer Configuration.
c. Double-click Administrative Templates, then Network,
Network Connections, and then Windows Firewall.
d. If the computer is in the domain, then double-click
Domain Profile; otherwise, double-click Standard Profile.
e. Click Windows Firewall: Allow inbound remote
administration exception.
f. On the Action menu either select Edit, or double-click
the selection from the previous step.
g. Check the Enabled radio button, and then click OK.
Using the NETSH command:
a. Open a command prompt window with Administrative rights
(you can right-click the Command Prompt icon and click
Run as Administrator).
b. Execute the following command:
NETSH firewall set service RemoteAdmin enable
2. Open the DCOM port TCP 135:
a. Open a command prompt window with Administrative rights
(you can right-click the Command Prompt icon and click
Run as Administrator) .
b. Execute the following command:
NETSH firewall add portopening protocol=tcp port=135 name=DCOM_TCP135
3. Add the client application which contains the sink for the
callback (MySqlNotifier.exe) to the Windows Firewall
Exceptions List (use either the Windows Firewall configuration
or NETSH):
Using the Windows Firewall configuration:
a. In the Control Panel, double-click Windows Firewall.
b. In the Windows Firewall window's left panel, click Allow
a program or feature through Windows Firewall.
c. In the Allowed Programs window, click Change Settings.
d. If MySqlNotifier.exe is in the Allowed programs and
features list, make sure it is checked for the type of
networks the computer connects to (Private, Public or
both).
e. If MySqlNotifier.exe is not in the list, click Allow
another program....
f. In the Add a Program window, select the MySqlNotifier.exe
if it exists in the Programs list, otherwise click
Browse... and go to the directory where MySqlNotifier.exe
was installed to select it, then click Add.
g. Make sure MySqlNotifier.exe is checked for the type of
networks the computer connects to (Private, Public or
both).
Using the NETSH command:
a. Open a command prompt window with Administrative rights
(you can right-click the Command Prompt icon and click
Run as Administrator).
b. Execute the following command, where you change
"[YOUR_INSTALL_DIRECTORY]":
NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\My
SqlNotifier.exe name=MySqlNotifier
4. If Computer B is either a member of WORKGROUP or is in a
different domain that is untrusted by Computer A, then the
callback connection (Connection 2) is created as an Anonymous
connection. To grant Anonymous connections DCOM Remote Access
permissions:
a. Click Start, click Run, type DCOMCNFG, and then click OK.
b. In the Component Services dialog box, expand Component
Services, expand Computers, and then right-click My
Computer and click Properties.
c. In the My Computer Properties dialog box, click the COM
Security tab.
d. Under Access Permissions, click Edit Limits.
e. In the Access Permission dialog box, select ANONYMOUS
LOGON name in the Group or user names box. In the Allow
column under Permissions for User, select Remote Access,
and then click OK.
Monitored Remote Computer (Computer B)
If the user account that is logged into the computer running the
MySQL Notifier for Microsoft Windows (Computer A) is a local
administrator on the remote computer (Computer B), such that the
same account is an administrator on Computer B, you can skip to
the "Allow for remote administration" step.
Setting DCOM security to allow a non-administrator user to access
a computer remotely:
1. Grant "DCOM remote launch" and activation permissions for a
user or group:
a. Click Start, click Run, type DCOMCNFG, and then click OK.
b. In the Component Services dialog box, expand Component
Services, expand Computers, and then right-click My
Computer and click Properties.
c. In the My Computer Properties dialog box, click the COM
Security tab.
d. Under Access Permissions, click Edit Limits.
e. In the Launch Permission dialog box, follow these steps
if your name or your group does not appear in the Groups
or user names list:
i. In the Launch Permission dialog box, click Add.
ii. In the Select Users, Computers, or Groups dialog
box, add your name and the group in the "Enter the
object names to select" box, and then click OK.
f. In the Launch Permission dialog box, select your user and
group in the Group or user names box. In the Allow column
under Permissions for User, select Remote Launch, select
Remote Activation, and then click OK.
Grant DCOM remote access permissions:
a. Click Start, click Run, type DCOMCNFG, and then click OK.
b. In the Component Services dialog box, expand Component
Services, expand Computers, and then right-click My
Computer and click Properties.
c. In the My Computer Properties dialog box, click the COM
Security tab.
d. Under Access Permissions, click Edit Limits.
e. In the Access Permission dialog box, select ANONYMOUS
LOGON name in the Group or user names box. In the Allow
column under Permissions for User, select Remote Access,
and then click OK.
2. Allowing non-administrator users access to a specific WMI
namespace:
a. In the Control Panel, double-click Administrative Tools.
b. In the Administrative Tools window, double-click Computer
Management.
c. In the Computer Management window, expand the Services
and Applications tree and double-click the WMI Control.
d. Right-click the WMI Control icon and select Properties.
e. In the WMI Control Properties window, click the Security
tab.
f. In the Security tab, select the namespace and click
Security.
g. Locate the appropriate account and check Remote Enable in
the Permissions list.
3. Allow for remote administration by either editing the Group
Policy Editor or using NETSH:
Using the Group Policy Editor:
a. Click Start, click Run, type GPEDIT.MSC, and then click
OK.
b. Under the Local Computer Policy heading, double-click
Computer Configuration.
c. Double-click Administrative Templates, then Network,
Network Connections, and then Windows Firewall.
d. If the computer is in the domain, then double-click
Domain Profile; otherwise, double-click Standard Profile.
e. Click Windows Firewall: Allow inbound remote
administration exception.
f. On the Action menu either select Edit, or double-click
the selection from the previous step.
g. Check the Enabled radio button, and then click OK.
Using the NETSH command:
a. Open a command prompt window with Administrative rights
(you can right-click the Command Prompt icon and click
Run as Administrator).
b. Execute the following command:
NETSH firewall set service RemoteAdmin enable
4. Now, be sure the user you are logging in with uses the Name
value and not the Full Name value:
a. In the Control Panel, double-click Administrative Tools.
b. In the Administrative Tools window, double-click Computer
Management.
c. In the Computer Management window, expand the System
Tools then Local Users and Groups.
d. Click the Users node, and on the right side panel locate
your user and make sure it uses the Name value to
connect, and not the Full Name value.
5. If the remote computer is running on Windows XP Professional,
make sure that remote logins are not being forcefully changed
to the guest account user (also known as ForceGuest), which is
enabled by default on computers that are not attached to a
domain.
a. Click Start, click Run, type SECPOL.MSC, and then click
OK.
b. Under the Local Policies node, double-click Security
Options.
c. Select Network Access: Sharing and security model for
local accounts and save.
Common Errors
* 0x80070005
+ DCOM Security was not configured properly (see Computer
B, the Setting DCOM security... step).
+ The remote computer (Computer B) is a member of WORKGROUP
or is in a domain that is untrusted by the client
computer (Computer A) (see Computer A, the Grant
Anonymous connections DCOM Remote Access permissions
step).
* 0x8007000E
+ The remote computer (Computer B) is a member of WORKGROUP
or is in a domain that is untrusted by the client
computer (Computer A) (see Computer A, the Grant
Anonymous connections DCOM Remote Access permissions
step).
* 0x80041003
+ Access to the remote WMI namespace was not configured
properly (see Computer B, the Allowing non-administrator
users access to a specific WMI namespace step).
* 0x800706BA
+ The DCOM port is not open on the client computers
(Computer A) firewall. See the Open the DCOM port TCP 135
step for Computer A.
+ The remote computer (Computer B) is inaccessible because
its network location is set to Public. Make sure you can
access it through the Windows Explorer.
2.3.5. Using the MySQL Server Instance Config Wizard
The MySQL Server Instance Config Wizard helps automate the process
of configuring your server. It creates a custom MySQL
configuration file (my.ini or my.cnf) by asking you a series of
questions and then applying your responses to a template to
generate the configuration file that is tuned to your
installation.
The complete and essential MSI installation packages include the
MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
MySQL Server Instance Config Wizard is only available for Windows.
The workflow sequence for using the MySQL Server Instance Config
Wizard is shown in the figure below:
Figure 2.18. MySQL Server Instance Config Wizard Workflow
MySQL Server Instance Config Wizard Workflow
2.3.5.1. Starting the MySQL Server Instance Config Wizard
The MySQL Server Instance Config Wizard is normally started as
part of the installation process. You should only need to run the
MySQL Server Instance Config Wizard again when you need to change
the configuration parameters of your server.
If you chose not to open a port prior to installing MySQL on
Windows Vista or newer, you can choose to use the MySQL Server
Instance Config Wizard after installation. However, you must open
a port in the Windows Firewall. To do this see the instructions
given in Section 2.3.3.1.1, "MySQL Installation Wizard:
Downloading and Starting." Rather than opening a port, you also
have the option of adding MySQL as a program that bypasses the
Windows Firewall. One or the other option is sufficient---you need
not do both. Additionally, when running the MySQL Server Config
Wizard on Windows Vista or newer, ensure that you are logged in as
a user with administrative rights.
MySQL Server Instance Config Wizard
You can launch the MySQL Config Wizard by clicking the MySQL
Server Instance Config Wizard entry in the MySQL section of the
Windows Start menu.
Alternatively, you can navigate to the bin directory of your MySQL
installation and launch the MySQLInstanceConfig.exe file directly.
The MySQL Server Instance Config Wizard places the my.ini file in
the installation directory for the MySQL server. This helps
associate configuration files with particular server instances.
To ensure that the MySQL server knows where to look for the my.ini
file, an argument similar to this is passed to the MySQL server as
part of the service installation:
--defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
installation path to the MySQL Server. The --defaults-file option
instructs the MySQL server to read the specified file for
configuration options when it starts.
Apart from making changes to the my.ini file by running the MySQL
Server Instance Config Wizard again, you can modify it by opening
it with a text editor and making any necessary changes. You can
also modify the server configuration with the
http://www.mysql.com/products/administrator/ utility. For more
information about server configuration, see Section 5.1.3, "Server
Command Options."
MySQL clients and utilities such as the mysql and mysqldump
command-line clients are not able to locate the my.ini file
located in the server installation directory. To configure the
client and utility applications, create a new my.ini file in the
Windows installation directory (for example, C:\WINDOWS).
Under Windows Server 2003, Windows Server 2000, Windows XP, and
Windows Vista, MySQL Server Instance Config Wizard will configure
MySQL to work as a Windows service. To start and stop MySQL you
use the Services application that is supplied as part of the
Windows Administrator Tools.
2.3.5.2. MySQL Server Instance Config Wizard: Choosing a Maintenance
Option
If the MySQL Server Instance Config Wizard detects an existing
configuration file, you have the option of either reconfiguring
your existing server, or removing the server instance by deleting
the configuration file and stopping and removing the MySQL
service.
To reconfigure an existing server, choose the Re-configure
Instance option and click the Next button. Any existing
configuration file is not overwritten, but renamed (within the
same directory) using a timestamp (Windows) or sequential number
(Linux). To remove the existing server instance, choose the Remove
Instance option and click the Next button.
If you choose the Remove Instance option, you advance to a
confirmation window. Click the Execute button. The MySQL Server
Config Wizard stops and removes the MySQL service, and then
deletes the configuration file. The server installation and its
data folder are not removed.
If you choose the Re-configure Instance option, you advance to the
Configuration Type dialog where you can choose the type of
installation that you wish to configure.
2.3.5.3. MySQL Server Instance Config Wizard: Choosing a
Configuration Type
When you start the MySQL Server Instance Config Wizard for a new
MySQL installation, or choose the Re-configure Instance option for
an existing installation, you advance to the Configuration Type
dialog.
MySQL Server Instance Config Wizard: Configuration Type
There are two configuration types available: Detailed
Configuration and Standard Configuration. The Standard
Configuration option is intended for new users who want to get
started with MySQL quickly without having to make many decisions
about server configuration. The Detailed Configuration option is
intended for advanced users who want more fine-grained control
over server configuration.
If you are new to MySQL and need a server configured as a
single-user developer machine, the Standard Configuration should
suit your needs. Choosing the Standard Configuration option causes
the MySQL Config Wizard to set all configuration options
automatically with the exception of Service Options and Security
Options.
The Standard Configuration sets options that may be incompatible
with systems where there are existing MySQL installations. If you
have an existing MySQL installation on your system in addition to
the installation you wish to configure, the Detailed Configuration
option is recommended.
To complete the Standard Configuration, please refer to the
sections on Service Options and Security Options in Section
2.3.5.10, "MySQL Server Instance Config Wizard: The Service
Options Dialog," and Section 2.3.5.11, "MySQL Server Instance
Config Wizard: The Security Options Dialog," respectively.
2.3.5.4. MySQL Server Instance Config Wizard: The Server Type Dialog
There are three different server types available to choose from.
The server type that you choose affects the decisions that the
MySQL Server Instance Config Wizard makes with regard to memory,
disk, and processor usage.
MySQL Server Instance Config Wizard: Server Type
* Developer Machine: Choose this option for a typical desktop
workstation where MySQL is intended only for personal use. It
is assumed that many other desktop applications are running.
The MySQL server is configured to use minimal system
resources.
* Server Machine: Choose this option for a server machine where
the MySQL server is running alongside other server
applications such as FTP, email, and Web servers. The MySQL
server is configured to use a moderate portion of the system
resources.
* Dedicated MySQL Server Machine: Choose this option for a
server machine that is intended to run only the MySQL server.
It is assumed that no other applications are running. The
MySQL server is configured to use all available system
resources.
Note
By selecting one of the preconfigured configurations, the values
and settings of various options in your my.cnf or my.ini will be
altered accordingly. The default values and options as described
in the reference manual may therefore be different to the options
and values that were created during the execution of the Config
Wizard.
2.3.5.5. MySQL Server Instance Config Wizard: The Database Usage
Dialog
The Database Usage dialog enables you to indicate the storage
engines that you expect to use when creating MySQL tables. The
option you choose determines whether the InnoDB storage engine is
available and what percentage of the server resources are
available to InnoDB.
MySQL Server Instance Config Wizard: Usage Dialog
* Multifunctional Database: This option enables both the InnoDB
and MyISAM storage engines and divides resources evenly
between the two. This option is recommended for users who use
both storage engines on a regular basis.
* Transactional Database Only: This option enables both the
InnoDB and MyISAM storage engines, but dedicates most server
resources to the InnoDB storage engine. This option is
recommended for users who use InnoDB almost exclusively and
make only minimal use of MyISAM.
* Non-Transactional Database Only: This option disables the
InnoDB storage engine completely and dedicates all server
resources to the MyISAM storage engine. This option is
recommended for users who do not use InnoDB.
The Config Wizard uses a template to generate the server
configuration file. The Database Usage dialog sets one of the
following option strings:
Multifunctional Database: MIXED
Transactional Database Only: INNODB
Non-Transactional Database Only: MYISAM
When these options are processed through the default template
(my-template.ini) the result is:
Multifunctional Database:
default-storage-engine=InnoDB
_myisam_pct=50
Transactional Database Only:
default-storage-engine=InnoDB
_myisam_pct=5
Non-Transactional Database Only:
default-storage-engine=MyISAM
_myisam_pct=100
skip-innodb
The _myisam_pct value is used to calculate the percentage of
resources dedicated to MyISAM. The remaining resources are
allocated to InnoDB.
2.3.5.6. MySQL Server Instance Config Wizard: The InnoDB Tablespace
Dialog
Some users may want to locate the InnoDB tablespace files in a
different location than the MySQL server data directory. Placing
the tablespace files in a separate location can be desirable if
your system has a higher capacity or higher performance storage
device available, such as a RAID storage system.
MySQL Server Instance Config Wizard: InnoDB Data Tablespace
To change the default location for the InnoDB tablespace files,
choose a new drive from the drop-down list of drive letters and
choose a new path from the drop-down list of paths. To create a
custom path, click the ... button.
If you are modifying the configuration of an existing server, you
must click the Modify button before you change the path. In this
situation you must move the existing tablespace files to the new
location manually before starting the server.
2.3.5.7. MySQL Server Instance Config Wizard: The Concurrent
Connections Dialog
To prevent the server from running out of resources, it is
important to limit the number of concurrent connections to the
MySQL server that can be established. The Concurrent Connections
dialog enables you to choose the expected usage of your server,
and sets the limit for concurrent connections accordingly. It is
also possible to set the concurrent connection limit manually.
MySQL Server Instance Config Wizard: Connections
* Decision Support (DSS)/OLAP: Choose this option if your server
does not require a large number of concurrent connections. The
maximum number of connections is set at 100, with an average
of 20 concurrent connections assumed.
* Online Transaction Processing (OLTP): Choose this option if
your server requires a large number of concurrent connections.
The maximum number of connections is set at 500.
* Manual Setting: Choose this option to set the maximum number
of concurrent connections to the server manually. Choose the
number of concurrent connections from the drop-down box
provided, or enter the maximum number of connections into the
drop-down box if the number you desire is not listed.
2.3.5.8. MySQL Server Instance Config Wizard: The Networking and
Strict Mode Options Dialog
Use the Networking Options dialog to enable or disable TCP/IP
networking and to configure the port number that is used to
connect to the MySQL server.
MySQL Server Instance Config Wizard: Network Configuration
TCP/IP networking is enabled by default. To disable TCP/IP
networking, uncheck the box next to the Enable TCP/IP Networking
option.
Port 3306 is used by default. To change the port used to access
MySQL, choose a new port number from the drop-down box or type a
new port number directly into the drop-down box. If the port
number you choose is in use, you are prompted to confirm your
choice of port number.
Set the Server SQL Mode to either enable or disable strict mode.
Enabling strict mode (default) makes MySQL behave more like other
database management systems. If you run applications that rely on
MySQL's old "forgiving" behavior, make sure to either adapt those
applications or to disable strict mode. For more information about
strict mode, see Section 5.1.7, "Server SQL Modes."
2.3.5.9. MySQL Server Instance Config Wizard: The Character Set
Dialog
The MySQL server supports multiple character sets and it is
possible to set a default server character set that is applied to
all tables, columns, and databases unless overridden. Use the
Character Set dialog to change the default character set of the
MySQL server.
MySQL Server Instance Config Wizard: Character Set
* Standard Character Set: Choose this option if you want to use
latin1 as the default server character set. latin1 is used for
English and many Western European languages.
* Best Support For Multilingualism: Choose this option if you
want to use utf8 as the default server character set. This is
a Unicode character set that can store characters from many
different languages.
* Manual Selected Default Character Set / Collation: Choose this
option if you want to pick the server's default character set
manually. Choose the desired character set from the provided
drop-down list.
2.3.5.10. MySQL Server Instance Config Wizard: The Service Options
Dialog
On Windows platforms, the MySQL server can be installed as a
Windows service. When installed this way, the MySQL server can be
started automatically during system startup, and even restarted
automatically by Windows in the event of a service failure.
The MySQL Server Instance Config Wizard installs the MySQL server
as a service by default, using the service name MySQL. If you do
not wish to install the service, uncheck the box next to the
Install As Windows Service option. You can change the service name
by picking a new service name from the drop-down box provided or
by entering a new service name into the drop-down box.
Note
Service names can include any legal character except forward (/)
or backward (\) slashes, and must be less than 256 characters
long.
Warning
If you are installing multiple versions of MySQL onto the same
machine, you must choose a different service name for each version
that you install. If you do not choose a different service for
each installed version then the service manager information will
be inconsistent and this will cause problems when you try to
uninstall a previous version.
If you have already installed multiple versions using the same
service name, you must manually edit the contents of the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
within the Windows registry to update the association of the
service name with the correct server version.
Typically, when installing multiple versions you create a service
name based on the version information. For example, you might
install MySQL 5.x as mysql5, or specific versions such as MySQL
5.1.30 as mysql50130.
To install the MySQL server as a service but not have it started
automatically at startup, uncheck the box next to the Launch the
MySQL Server Automatically option.
2.3.5.11. MySQL Server Instance Config Wizard: The Security Options
Dialog
The content of the security options portion of the MySQL Server
Instance Configuration Wizard will depend on whether this is a new
installation, or modifying an existing installation.
* Setting the root password for a new installation
It is strongly recommended that you set a root password for
your MySQL server, and the MySQL Server Instance Config Wizard
requires by default that you do so. If you do not wish to set
a root password, uncheck the box next to the Modify Security
Settings option.
Note
If you have previously installed MySQL, but not deleted the
data directory associated with the previous installation, you
may be prompted to provide the current root password. The
password will be the one configured with your old data
directory. If you do not want to use this data, or do not know
the root password, you should cancel the installation, delete
the previous installation data, and then restart the
installation process. For more information on deleting MySQL
data on Microsoft Windows, see Section 2.3.3.3, "Removing
MySQL When Installed from the MSI Package."
MySQL Server Instance Config Wizard: Security
* To set the root password, enter the desired password into both
the New root password and Confirm boxes.
Setting the root password for an existing installation
If you are modifying the configuration of an existing
configuration, or you are installing an upgrade and the MySQL
Server Instance Configuration Wizard has detected an existing
MySQL system, then you must enter the existing password for
root before changing the configuration information.
MySQL Server Instance Config Wizard: Security (Existing
Installation)
If you want to change the current root password, enter the
desired new password into both the New root password and
Confirm boxes.
To permit root logins from across the network, check the box next
to the Enable root access from remote machines option. This
decreases the security of your root account.
To create an anonymous user account, check the box next to the
Create An Anonymous Account option. Creating an anonymous account
can decrease server security and cause login and permission
difficulties. For this reason, it is not recommended.
2.3.5.12. MySQL Server Instance Config Wizard: The Confirmation
Dialog
The final dialog in the MySQL Server Instance Config Wizard is the
Confirmation Dialog. To start the configuration process, click the
Execute button. To return to a previous dialog, click the Back
button. To exit the MySQL Server Instance Config Wizard without
configuring the server, click the Cancel button.
MySQL Server Instance Config Wizard: Confirmation
After you click the Execute button, the MySQL Server Instance
Config Wizard performs a series of tasks and displays the progress
onscreen as the tasks are performed.
The MySQL Server Instance Config Wizard first determines
configuration file options based on your choices using a template
prepared by MySQL developers and engineers. This template is named
my-template.ini and is located in your server installation
directory.
The MySQL Config Wizard then writes these options to the
corresponding configuration file.
If you chose to create a service for the MySQL server, the MySQL
Server Instance Config Wizard creates and starts the service. If
you are reconfiguring an existing service, the MySQL Server
Instance Config Wizard restarts the service to apply your
configuration changes.
If you chose to set a root password, the MySQL Config Wizard
connects to the server, sets your new root password, and applies
any other security settings you may have selected.
After the MySQL Server Instance Config Wizard has completed its
tasks, it displays a summary. Click the Finish button to exit the
MySQL Server Config Wizard.
2.3.5.13. MySQL Server Instance Config Wizard: Creating an Instance
from the Command Line
In addition to using the GUI interface to the MySQL Server
Instance Config Wizard, you can also create instances
automatically from the command line.
To use the MySQL Server Instance Config Wizard on the command
line, you need to use the MySQLInstanceConfig.exe command that is
installed with MySQL in the bin directory within the installation
directory. MySQLInstanceConfig.exe takes a number of command-line
arguments the set the properties that would normally be selected
through the GUI interface, and then creates a new configuration
file (my.ini) by combining these selections with a template
configuration file to produce the working configuration file.
The main command line options are provided in the table below.
Some of the options are required, while some options are optional.
Table 2.7. MySQL Server Instance Config Wizard Command Line
Options
Option Description
Required Parameters
-nPRODUCTNAME The name of the instance when installed
-pPATH Path of the base directory for installation. This is
equivalent to the directory when using the basedir configuration
parameter
-vVERSION The version tag to use for this installation
Action to Perform
-i Install an instance
-r Remove an instance
-s Stop an existing instance
-q Perform the operation quietly
-lFILENAME Sae the installation progress in a logfile
Config File to Use
-tFILENAME Path to the template config file that will be used to
generate the installed configuration file
-cFILENAME Path to a config file to be generated
The -t and -c options work together to set the configuration
parameters for a new instance. The -t option specifies the
template configuration file to use as the basic configuration,
which are then merged with the configuration parameters generated
by the MySQL Server Instance Config Wizard into the configuration
file specified by the -c option.
A sample template file, my-template.ini is provided in the
toplevel MySQL installation directory. The file contains elements
are replaced automatically by the MySQL Server Instance Config
Wizard during configuration.
If you specify a configuration file that already exists, the
existing configuration file will be saved in the file with the
original, with the date and time added. For example, the mysql.ini
will be copied to mysql 2009-10-27 1646.ini.bak.
The parameters that you can specify on the command line are listed
in the table below.
Table 2.8. MySQL Server Instance Config Wizard Parameters
Parameter Description
ServiceName=$ Specify the name of the service to be created
AddBinToPath={yes | no} Specifies whether to add the binary
directory of MySQL to the standard PATH environment variable
ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
type. For more information, see Section 2.3.5.4, "MySQL Server
Instance Config Wizard: The Server Type Dialog"
DatabaseType={MIXED | INNODB | MYISAM} Specify the default
database type. For more information, see Section 2.3.5.5, "MySQL
Server Instance Config Wizard: The Database Usage Dialog"
ConnectionUsage={DSS | OLTP} Specify the type of connection
support, this automates the setting for the number of concurrent
connections (see the ConnectionCount parameter). For more
information, see Section 2.3.5.7, "MySQL Server Instance Config
Wizard: The Concurrent Connections Dialog"
ConnectionCount=# Specify the number of concurrent connections to
support. For more information, see Section 2.3.5.4, "MySQL Server
Instance Config Wizard: The Server Type Dialog"
SkipNetworking={yes | no} Specify whether network support should
be supported. Specifying yes disables network access altogether
Port=# Specify the network port number to use for network
connections. For more information, see Section 2.3.5.8, "MySQL
Server Instance Config Wizard: The Networking and Strict Mode
Options Dialog"
StrictMode={yes | no} Specify whether to use the strict SQL mode.
For more information, see Section 2.3.5.8, "MySQL Server Instance
Config Wizard: The Networking and Strict Mode Options Dialog"
Charset=$ Specify the default character set. For more information,
see Section 2.3.5.9, "MySQL Server Instance Config Wizard: The
Character Set Dialog"
RootPassword=$ Specify the root password
RootCurrentPassword=$ Specify the current root password then
stopping or reconfiguring an existing service
Note
When specifying options on the command line, you can enclose the
entire command-line option and the value you are specifying using
double quotation marks. This enables you to use spaces in the
options. For example, "-cC:\mysql.ini".
The following command installs a MySQL Server 5.1 instance from
the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
service name MySQL51 and setting the root password to 1234.
shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
"-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
v5.1.74 »
"-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
aseType=MIXED »
ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
4
In the above example, a log file will be generated in
mysql_install_log.txt containing the information about the
instance creation process. The log file generated by the above
example is shown below:
Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
Date: 2009-10-27 17:07:21
Installing service ...
Product Name: MySQL Server 5.1
Version: 5.1.74
Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\
Creating configuration file C:\mytest.ini using template my-template.
ini.
Options:
DEVELOPMENT
MIXED
DSS
STRICTMODE
Variables:
port: 3311
default-character-set: latin1
basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
Creating Windows service entry.
Service name: "MySQL51"
Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
defaults-file="C:\mytest.ini" MySQL51.
Windows service MySQL51 installed.
When using the command line, the return values in the following
table indicate an error performing the specified option.
Table 2.9. Return Value from MySQL Server Instance Config Wizard
Value Description
2 Configuration template file cannot be found
3 The Windows service entry cannot be created
4 Could not connect to the Service Control Manager
5 The MySQL service cannot be started
6 The MySQL service cannot be stopped
7 The security settings cannot be applied
8 The configuration file cannot be written
9 The Windows service entry cannot be removed
You can perform an installation of MySQL automatically using the
MSI package. For more information, see Section 2.3.3.2,
"Automating MySQL Installation on Microsoft Windows Using the MSI
Package."
2.3.6. Installing MySQL on Microsoft Windows Using a noinstall Zip
Archive
Users who are installing from the noinstall package can use the
instructions in this section to manually install MySQL. The
process for installing MySQL from a Zip archive is as follows:
1. Extract the archive to the desired install directory
2. Create an option file
3. Choose a MySQL server type
4. Start the MySQL server
5. Secure the default user accounts
This process is described in the sections that follow.
2.3.6.1. Extracting the Install Archive
To install MySQL manually, do the following:
1. If you are upgrading from a previous version please refer to
Section 2.3.8, "Upgrading MySQL Server on Microsoft Windows,"
before beginning the upgrade process.
2. Make sure that you are logged in as a user with administrator
privileges.
3. Choose an installation location. Traditionally, the MySQL
server is installed in C:\mysql. The MySQL Installation Wizard
installs MySQL under C:\Program Files\MySQL. If you do not
install MySQL at C:\mysql, you must specify the path to the
install directory during startup or in an option file. See
Section 2.3.6.2, "Creating an Option File."
4. Extract the install archive to the chosen installation
location using your preferred Zip archive tool. Some tools may
extract the archive to a folder within your chosen
installation location. If this occurs, you can move the
contents of the subfolder into the chosen installation
location.
2.3.6.2. Creating an Option File
If you need to specify startup options when you run the server,
you can indicate them on the command line or place them in an
option file. For options that are used every time the server
starts, you may find it most convenient to use an option file to
specify your MySQL configuration. This is particularly true under
the following circumstances:
* The installation or data directory locations are different
from the default locations (C:\Program Files\MySQL\MySQL
Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
* You need to tune the server settings, such as memory, cache,
or InnoDB configuration information.
When the MySQL server starts on Windows, it looks for option files
in several locations, such as the Windows directory, C:\, and the
MySQL installation directory (for the full list of locations, see
Section 4.2.3.3, "Using Option Files"). The Windows directory
typically is named something like C:\WINDOWS. You can determine
its exact location from the value of the WINDIR environment
variable using the following command:
C:\> echo %WINDIR%
MySQL looks for options in each location first in the my.ini file,
and then in the my.cnf file. However, to avoid confusion, it is
best if you use only one file. If your PC uses a boot loader where
C: is not the boot drive, your only option is to use the my.ini
file. Whichever option file you use, it must be a plain text file.
You can also make use of the example option files included with
your MySQL distribution; see Section 5.1.2, "Server Configuration
Defaults."
An option file can be created and modified with any text editor,
such as Notepad. For example, if MySQL is installed in E:\mysql
and the data directory is in E:\mydata\data, you can create an
option file containing a [mysqld] section to specify values for
the basedir and datadir options:
[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=E:/mydata/data
Note that Windows path names are specified in option files using
(forward) slashes rather than backslashes. If you do use
backslashes, double them:
[mysqld]
# set basedir to your installation path
basedir=E:\\mysql
# set datadir to the location of your data directory
datadir=E:\\mydata\\data
The rules for use of backslash in option file values are given in
Section 4.2.3.3, "Using Option Files."
In MySQL 5.1.23 and earlier, the MySQL installer places the data
directory directly under the directory where you install MySQL. On
MySQL 5.1.24 and later, the data directory is located within the
AppData directory for the user running MySQL.
If you would like to use a data directory in a different location,
you should copy the entire contents of the data directory to the
new location. For example, if you want to use E:\mydata as the
data directory instead, you must do two things:
1. Move the entire data directory and all of its contents from
the default location (for example C:\Program Files\MySQL\MySQL
Server 5.1\data) to E:\mydata.
2. Use a --datadir option to specify the new data directory
location each time you start the server.
2.3.6.3. Selecting a MySQL Server Type
The following table shows the available servers for Windows in
MySQL 5.1.20 and earlier.
Table 2.10. mysqld binary types for Microsoft Windows up to MySQL
5.1.20
Binary Description
mysqld-nt Optimized binary with named-pipe support
mysqld Optimized binary without named-pipe support
mysqld-debug Like mysqld-nt, but compiled with full debugging and
automatic memory allocation checking
The following table shows the available servers for Windows in
MySQL 5.1.21 and later.
Table 2.11. mysqld binary types for Microsoft Windows MySQL 5.1.21
and later
Binary Description
mysqld Optimized binary with named-pipe support
mysqld-debug Like mysqld, but compiled with full debugging and
automatic memory allocation checking
All of the preceding binaries are optimized for modern Intel
processors, but should work on any Intel i386-class or higher
processor.
Each of the servers in a distribution support the same set of
storage engines. The SHOW ENGINES statement displays which engines
a given server supports.
All Windows MySQL 5.1 servers have support for symbolic linking of
database directories.
MySQL supports TCP/IP on all Windows platforms. MySQL servers on
Windows support named pipes as indicated in the following list.
However, the default is to use TCP/IP regardless of platform.
(Named pipes are slower than TCP/IP in many Windows
configurations.)
Use of named pipes is subject to these conditions:
* Named pipes are enabled only if you start the server with the
--enable-named-pipe option. It is necessary to use this option
explicitly because some users have experienced problems with
shutting down the MySQL server when named pipes were used.
* For MySQL 5.1.20 and earlier, named-pipe connections are
permitted only by the mysqld-nt and mysqld-debug servers. For
MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
both contain support for named-pipe connections.
Note
Most of the examples in this manual use mysqld as the server name.
If you choose to use a different server, such as mysqld-nt or
mysqld-debug, make the appropriate substitutions in the commands
that are shown in the examples.
2.3.6.4. Starting MySQL Server on Microsoft Windows for the First
Time
This section gives a general overview of starting the MySQL
server. The following sections provide more specific information
for starting the MySQL server from the command line or as a
Windows service.
The information here applies primarily if you installed MySQL
using the Noinstall version, or if you wish to configure and test
MySQL manually rather than with the GUI tools.
The examples in these sections assume that MySQL is installed
under the default location of C:\Program Files\MySQL\MySQL Server
5.1. Adjust the path names shown in the examples if you have MySQL
installed in a different location.
Clients have two options. They can use TCP/IP, or they can use a
named pipe if the server supports named-pipe connections.
MySQL for Windows also supports shared-memory connections if the
server is started with the --shared-memory option. Clients can
connect through shared memory by using the --protocol=MEMORY
option.
For information about which server binary to run, see Section
2.3.6.3, "Selecting a MySQL Server Type."
Testing is best done from a command prompt in a console window (or
"DOS window"). In this way you can have the server display status
messages in the window where they are easy to see. If something is
wrong with your configuration, these messages make it easier for
you to identify and fix any problems.
To start the server, enter this command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
For a server that includes InnoDB support, you should see the
messages similar to those following as it starts (the path names
and sizes may differ):
InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
InnoDB: a new database to be created!
InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
InnoDB: Database physically writes the file full: wait...
InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
ed
InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
ed
InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
ed
InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: creating foreign key constraint system tables
InnoDB: foreign key constraint system tables created
011024 10:58:25 InnoDB: Started
When the server finishes its startup sequence, you should see
something like this, which indicates that the server is ready to
service client connections:
mysqld: ready for connections
Version: '5.1.74' socket: '' port: 3306
The server continues to write to the console any further
diagnostic output it produces. You can open a new console window
in which to run client programs.
If you omit the --console option, the server writes diagnostic
output to the error log in the data directory (C:\Program
Files\MySQL\MySQL Server 5.1\data by default). The error log is
the file with the .err extension.
Note
The accounts that are listed in the MySQL grant tables initially
have no passwords. After starting the server, you should set up
passwords for them using the instructions in Section 2.12.2,
"Securing the Initial MySQL Accounts."
2.3.6.5. Starting MySQL Server from the Windows Command Line
The MySQL server can be started manually from the command line.
This can be done on any version of Windows.
To start the mysqld server from the command line, you should start
a console window (or "DOS window") and enter this command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
The path to mysqld may vary depending on the install location of
MySQL on your system.
You can stop the MySQL server by executing this command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
shutdown
Note
If the MySQL root user account has a password, you need to invoke
mysqladmin with the -p option and supply the password when
prompted.
This command invokes the MySQL administrative utility mysqladmin
to connect to the server and tell it to shut down. The command
connects as the MySQL root user, which is the default
administrative account in the MySQL grant system. Note that users
in the MySQL grant system are wholly independent from any login
users under Windows.
If mysqld doesn't start, check the error log to see whether the
server wrote any messages there to indicate the cause of the
problem. The error log is located in the C:\Program
Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
suffix of .err. You can also try to start the server as mysqld
--console; in this case, you may get some useful information on
the screen that may help solve the problem.
The last option is to start mysqld with the --standalone and
--debug options. In this case, mysqld writes a log file
C:\mysqld.trace that should contain the reason why mysqld doesn't
start. See Section 22.4.3, "The DBUG Package."
Use mysqld --verbose --help to display all the options that mysqld
supports.
2.3.6.6. Customizing the PATH for MySQL Tools
To make it easier to invoke MySQL programs, you can add the path
name of the MySQL bin directory to your Windows system PATH
environment variable:
* On the Windows desktop, right-click the My Computer icon, and
select Properties.
* Next select the Advanced tab from the System Properties menu
that appears, and click the Environment Variables button.
* Under System Variables, select Path, and then click the Edit
button. The Edit System Variable dialogue should appear.
* Place your cursor at the end of the text appearing in the
space marked Variable Value. (Use the End key to ensure that
your cursor is positioned at the very end of the text in this
space.) Then enter the complete path name of your MySQL bin
directory (for example, C:\Program Files\MySQL\MySQL Server
5.1\bin)
Note
There must be a semicolon separating this path from any values
present in this field.
Dismiss this dialogue, and each dialogue in turn, by clicking
OK until all of the dialogues that were opened have been
dismissed. You should now be able to invoke any MySQL
executable program by typing its name at the DOS prompt from
any directory on the system, without having to supply the
path. This includes the servers, the mysql client, and all
MySQL command-line utilities such as mysqladmin and mysqldump.
You should not add the MySQL bin directory to your Windows
PATH if you are running multiple MySQL servers on the same
machine.
Warning
You must exercise great care when editing your system PATH by
hand; accidental deletion or modification of any portion of the
existing PATH value can leave you with a malfunctioning or even
unusable system.
2.3.6.7. Starting MySQL Server as a Microsoft Windows Service
On Windows, the recommended way to run MySQL is to install it as a
Windows service, so that MySQL starts and stops automatically when
Windows starts and stops, and can be managed using the service
manager framework. A MySQL server installed as a service can also
be controlled from the command line using NET commands, or with
the graphical Services utility. Generally, to install MySQL as a
Windows service you should be logged in using an account that has
administrator rights.
The Services utility (the Windows Service Control Manager) can be
found in the Windows Control Panel (under Administrative Tools on
Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it
is advisable to close the Services utility while performing server
installation or removal operations from the command line.
Installing the service
Before installing MySQL as a Windows service, you should first
stop the current server if it is running by using the following
command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
-u root shutdown
Note
If the MySQL root user account has a password, you need to invoke
mysqladmin with the -p option and supply the password when
prompted.
This command invokes the MySQL administrative utility mysqladmin
to connect to the server and tell it to shut down. The command
connects as the MySQL root user, which is the default
administrative account in the MySQL grant system. Note that users
in the MySQL grant system are wholly independent from any login
users under Windows.
Install the server as a service using this command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
Note
The service-installation command does not start the server.
The following additional arguments can be used when installing the
service:
* You can specify a service name immediately following the
--install option. The default service name is MySQL.
* If a service name is given, it can be followed by a single
option. By convention, this should be
--defaults-file=file_name to specify the name of an option
file from which the server should read options when it starts.
The use of a single option other than --defaults-file is
possible but discouraged. --defaults-file is more flexible
because it enables you to specify multiple startup options for
the server by placing them in the named option file.
* You can also specify a --local-service option following the
service name. This causes the server to run using the
LocalService Windows account that has limited system
privileges. This account is available only for Windows XP or
newer. If both --defaults-file and --local-service are given
following the service name, they can be in any order.
For a MySQL server that is installed as a Windows service, the
following rules determine the service name and option files that
the server uses:
* If the service-installation command specifies no service name
or the default service name (MySQL) following the --install
option, the server uses the a service name of MySQL and reads
options from the [mysqld] group in the standard option files.
* If the service-installation command specifies a service name
other than MySQL following the --install option, the server
uses that service name. It reads options from the [mysqld]
group and the group that has the same name as the service in
the standard option files. This enables you to use the
[mysqld] group for options that should be used by all MySQL
services, and an option group with the service name for use by
the server installed with that service name.
* If the service-installation command specifies a
--defaults-file option after the service name, the server
reads options the same way as described in the previous item,
except that it reads options only from the the named file and
ignores the standard option files.
As a more complex example, consider the following command:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
--install MySQL --defaults-file=C:\my-opts.cnf
Here, the default service name (MySQL) is given after the
--install option. If no --defaults-file option had been given,
this command would have the effect of causing the server to read
the [mysqld] group from the standard option files. However,
because the --defaults-file option is present, the server reads
options from the [mysqld] option group, and only from the named
file.
Note
On Windows, if the server is started with the --defaults-file and
--install options, --install must be first. Otherwise, mysqld.exe
will attempt to start the MySQL server.
You can also specify options as Start parameters in the Windows
Services utility before you start the MySQL service.
Starting the service
Once a MySQL server has been installed as a service, Windows
starts the service automatically whenever Windows starts. The
service also can be started immediately from the Services utility,
or by using a NET START MySQL command. The NET command is not case
sensitive.
When run as a service, mysqld has no access to a console window,
so no messages can be seen there. If mysqld does not start, check
the error log to see whether the server wrote any messages there
to indicate the cause of the problem. The error log is located in
the MySQL data directory (for example, C:\Program
Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
of .err.
When a MySQL server has been installed as a service, and the
service is running, Windows stops the service automatically when
Windows shuts down. The server also can be stopped manually by
using the Services utility, the NET STOP MySQL command, or the
mysqladmin shutdown command.
You also have the choice of installing the server as a manual
service if you do not wish for the service to be started
automatically during the boot process. To do this, use the
--install-manual option rather than the --install option:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
anual
Removing the service
To remove a server that is installed as a service, first stop it
if it is running by executing NET STOP MySQL. Then use the
--remove option to remove it:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
If mysqld is not running as a service, you can start it from the
command line. For instructions, see Section 2.3.6.5, "Starting
MySQL Server from the Windows Command Line."
Please see Section 2.3.7, "Troubleshooting a Microsoft Windows
MySQL Server Installation," if you encounter difficulties during
installation.
2.3.6.8. Testing The MySQL Server Installation on Microsoft Windows
You can test whether the MySQL server is working by executing any
of the following commands:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
mysql
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
status proc
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
Note
By default, mysqlshow will try to connect using the ODBC user.
This user is not created by default. You should specify a valid
user, or root with the right password to check the operation of
the server.
If mysqld is slow to respond to TCP/IP connections from client
programs, there is probably a problem with your DNS. In this case,
start mysqld with the --skip-name-resolve option and use only
localhost and IP addresses in the Host column of the MySQL grant
tables.
You can force a MySQL client to use a named-pipe connection rather
than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
by specifying . (period) as the host name. Use the --socket option
to specify the name of the pipe if you do not want to use the
default pipe name.
Note that if you have set a password for the root account, deleted
the anonymous account, or created a new user account, then you
must use the appropriate -u and -p options with the commands shown
above to connect with the MySQL Server. See Section 4.2.2,
"Connecting to the MySQL Server."
For more information about mysqlshow, see Section 4.5.6,
"mysqlshow --- Display Database, Table, and Column Information."
2.3.7. Troubleshooting a Microsoft Windows MySQL Server Installation
When installing and running MySQL for the first time, you may
encounter certain errors that prevent the MySQL server from
starting. The purpose of this section is to help you diagnose and
correct some of these errors.
Your first resource when troubleshooting server issues is the
error log
(http://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_error_l
og). The MySQL server uses the error log to record information
relevant to the error that prevents the server from starting. The
error log is located in the data directory
(http://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_data_di
rectory) specified in your my.ini file. The default data directory
location is C:\Program Files\MySQL\MySQL Server 5.1\data, or
C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The
C:\ProgramData directory is hidden by default. You need to change
your folder options to see the directory and contents. For more
information on the error log and understanding the content, see
Section 5.2.2, "The Error Log."
Another source of information regarding possible errors is the
console messages displayed when the MySQL service is starting. Use
the NET START MySQL command from the command line after installing
mysqld as a service to see any error messages regarding the
starting of the MySQL server as a service. See Section 2.3.6.7,
"Starting MySQL Server as a Microsoft Windows Service."
The following examples show other common error messages you may
encounter when installing MySQL and starting the server for the
first time:
* If the MySQL server cannot find the mysql privileges database
or other critical files, you may see these messages:
System error 1067 has occurred.
Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
exist
These messages often occur when the MySQL base or data
directories are installed in different locations than the
default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
This situation may occur when MySQL is upgraded and installed
to a new location, but the configuration file is not updated
to reflect the new location. In addition, there may be old and
new configuration files that conflict. Be sure to delete or
rename any old configuration files when upgrading MySQL.
If you have installed MySQL to a directory other than
C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
that the MySQL server is aware of this through the use of a
configuration (my.ini) file. The my.ini file needs to be
located in your Windows directory, typically C:\WINDOWS. You
can determine its exact location from the value of the WINDIR
environment variable by issuing the following command from the
command prompt:
C:\> echo %WINDIR%
An option file can be created and modified with any text
editor, such as Notepad. For example, if MySQL is installed in
E:\mysql and the data directory is D:\MySQLdata, you can
create the option file and set up a [mysqld] section to
specify values for the basedir and datadir options:
[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=D:/MySQLdata
Note that Windows path names are specified in option files
using (forward) slashes rather than backslashes. If you do use
backslashes, double them:
[mysqld]
# set basedir to your installation path
basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
# set datadir to the location of your data directory
datadir=D:\\MySQLdata
The rules for use of backslash in option file values are given
in Section 4.2.3.3, "Using Option Files."
If you change the datadir value in your MySQL configuration
file, you must move the contents of the existing MySQL data
directory before restarting the MySQL server.
See Section 2.3.6.2, "Creating an Option File."
* If you reinstall or upgrade MySQL without first stopping and
removing the existing MySQL service and install MySQL using
the MySQL Config Wizard, you may see this error:
Error: Cannot create Windows service for MySql. Error: 0
This occurs when the Config Wizard tries to install the
service and finds an existing service with the same name.
One solution to this problem is to choose a service name other
than mysql when using the configuration wizard. This enables
the new service to be installed correctly, but leaves the
outdated service in place. Although this is harmless, it is
best to remove old services that are no longer in use.
To permanently remove the old mysql service, execute the
following command as a user with administrative privileges, on
the command-line:
C:\> sc delete mysql
[SC] DeleteService SUCCESS
If the sc utility is not available for your version of
Windows, download the delsrv utility from
http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
sting/delsrv-o.asp and use the delsrv mysql syntax.
2.3.8. Upgrading MySQL Server on Microsoft Windows
This section lists some of the steps you should take when
upgrading MySQL on Windows.
1. Review Section 2.13.1, "Upgrading MySQL," for additional
information on upgrading MySQL that is not specific to
Windows.
2. You should always back up your current MySQL installation
before performing an upgrade. See Section 7.2, "Database
Backup Methods."
3. Download the latest Windows distribution of MySQL from
http://dev.mysql.com/downloads/.
4. Before upgrading MySQL, you must stop the server. If the
server is installed as a service, stop the service with the
following command from the command prompt:
C:\> NET STOP MySQL
If you are not running the MySQL server as a service, use
mysqladmin to stop it. For example, before upgrading from
MySQL 5.0 to 5.1, use mysqladmin from MySQL 5.0 as follows:
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root
shutdown
Note
If the MySQL root user account has a password, you need to
invoke mysqladmin with the -p option and supply the password
when prompted.
5. Before upgrading to MySQL 5.1 from a version previous to
4.1.5, or from a version of MySQL installed from a Zip archive
to a version of MySQL installed with the MySQL Installation
Wizard, you must first manually remove the previous
installation and MySQL service (if the server is installed as
a service).
To remove the MySQL service, use the following command:
C:\> C:\mysql\bin\mysqld --remove
Important
If you do not remove the existing service, the MySQL
Installation Wizard may fail to properly install the new MySQL
service.
6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
in the default location of the data directory from a directory
within the MySQL installation to the AppData folder means that
you must manually copy the data files from your old
installation to the new location.
7. If you are using the MySQL Installation Wizard, start the
wizard as described in Section 2.3.3.1, "Using the MySQL
Installation Wizard for Microsoft Windows."
8. If you are installing MySQL from a Zip archive, extract the
archive. You may either overwrite your existing MySQL
installation (usually located at C:\mysql), or install it into
a different directory, such as C:\mysql5. Overwriting the
existing installation is recommended.
9. If you were running MySQL as a Windows service and you had to
remove the service earlier in this procedure, reinstall the
service. (See Section 2.3.6.7, "Starting MySQL Server as a
Microsoft Windows Service.")
10. Restart the server. For example, use NET START MySQL if you
run MySQL as a service, or invoke mysqld directly otherwise.
11. As Administrator, run mysql_upgrade to check your tables,
attempt to repair them if necessary, and update your grant
tables if they have changed so that you can take advantage of
any new capabilities. See Section 4.4.8, "mysql_upgrade ---
Check and Upgrade MySQL Tables."
12. If you encounter errors, see Section 2.3.7, "Troubleshooting a
Microsoft Windows MySQL Server Installation."
2.3.9. MySQL Server on Microsoft Windows Postinstallation Procedures
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 Windows Installation Wizard, you may have already assigned
passwords to the accounts. (See Section 2.3.3.1, "Using the MySQL
Installation Wizard for Microsoft Windows.") Otherwise, use the
password-assignment procedure given in Section 2.12.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.6.4, "Starting MySQL Server on Microsoft
Windows 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 Windows
Installation Wizard, 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 2.3.3.1, "Using the MySQL Installation Wizard for
Microsoft Windows," 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 the MSI
packages and used the MySQL Server Instance Config Wizard, 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.6.7, "Starting MySQL Server as a Microsoft
Windows Service."
Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights
reserved. Legal Notices
|