Installing MySQL Windows
Installing MySQL Windows
Background
MySQL is an open source relational database management system which is quite popular for light-weight web applications. Over the last few years, the product has also added some features which allow it to be used for larger business tools. This paper will provide an overview of this software on Windows. MySQL does not have as many features as PostgreSQL, and while many of the more advanced features are not as mature. However one would expect it to perform substantially better than PostgreSQL on Windows because of its thread-based architecture (PostgreSQL uses a process-based architecture instead).
Select User Accounts and Family Safety. This brings up the next screen:
From here, click User Accounts. This will bring up the following screen:
Select Turn User Account Control on or off. If User Account Control is enabled, it will pop up with a dialog asking for permission to continue. Click Continue and the User Account Control screen will appear:
Uncheck the box and click OK. You will need to restart your computer for the change to take effect. Once you have finished the installation, you can re-enable UAC and the software will continue to run without issue.
Planning
The typical install of MySQL 5.0 on Windows takes about 90MB plus space for data o Approximately 60MB for the software o Approximately 30MB for the database skeleton The software is installed to C:\Program Files\MySQL by default The data files are installed at C:\Program Files\MySQL\MySQL Server 5.0\data by default. This can be changed using the Server Configuration Wizard (see below). The amount of space required to store a given amount of data depends on the table type used and other factors. InnoDB uses the most storage while archive uses the least. General guidelines for storage capacity planning are difficult to arrive at because they are dependant on the storage engine used and, in some cases, on the level of concurrency expected in the application.
Generally speaking, if you are working with large datasets or expect high concurrency, you will want to consider carefully where you want to put the InnoDB tablespace. If this installation is for a small data set with little concurrency, then this can be left at its default.
In general, this tutorial focuses on the default option ("Choose this configuration type...").
In most cases, you may want to consider this choice somewhat carefully. The main table types supported on Windows are MyISAM and InnoDB. These use fundamentally different techniques for maintaining concurrent data and have different strengths and weaknesses. MyISAM was the first major table type that MySQL supported. It has no transactional rollback capability, and concurrency is controlled using table locks. It is optimized for rapid searches, but trades substantial data integrity controls for this performance gain. Foreign key constraints are not supported on MyISAM tables. For basic content management systems, it is probably the preferred table type. InnoDB (licensed now from Oracle), provides a Multi-Version Concurrency Control based storage engine similar in some ways to PostgreSQL. InnoDB is far slower than MyISAM for simple data retrieval, but would be expected to perform better when large numbers of inserts, updates, and selects must happen concurrently. This is because locking is not generally necessary to manage concurrency. However, full text indexing is not supported on this table type. Other table types exist (Heap, Merge, BDB being a few) but will be covered separately, as they are not generally as widely used as MyISAM and InnoDB.
If InnoDB is available, you will then be asked where you want that engine to store its files. The default is the data directory in the installation directory. Developer systems can leave this at the default. Production servers may do better to move this to a RAID array or similar device.
Strict mode is an important new feature in MySQL 5.0. In prior versions, MySQL tried very hard to commit a transaction without aborting it. Numbers would be truncated silently, and dates like Feb 31, 2007 would be accepted as valid. Because this sort of behavior was causing MySQL to be dismissed from projects requiring a "serious RDBMS," strict mode was added. This feature tightens down the validity checks on entered data but may break older applications. Note that strict mode can be turned off by users or applications on a per-connection basis so one should not use it as a major protection for data integrity. It is, however, one more protection which may be useful. The rest of the wizard needs no additional explanation.
InnoDB under load, but appears to take up less disk space. It may be worth considering when concurrency is expected to be low but space is at a premium. FEDERATED: This storage engine allows for management of external data on other MySQL servers. No data is stored in a FEDERATED table itself. There is no transaction support. InnoDB: This table uses a row-versioning in order to allow for transactional consistency. The back-end for this table was originally developed by Innobase (acquired recently by Oracle). It is licensed under the GPL, and MySQL AB purchases additional licenses for their enterprise customers. It requires more space. MERGE: This storage engine allows for partitioning of data across MyISAM tables. The MERGE is just the parent table (where no data is actually stored), while identical tables hold the partitions. MEMORY: This storage engine forces an entire table to be stored entirely in memory and never written to disk. It is therefore not ACID compliant, but is sometimes used as a useful developer tool (sort of an SQL interface to shared memory segments). MyISAM: This table type uses a flat file to store the data, and auxiliary files for indexes and metadata. Because there are no provisions for keeping data around after it is updated, MyISAM does not support transactional operations. It the oldest table type still supported.
To create a table with a specific table type, you can use the optional ENGINE keyword. For example: create table foo ( bar INT ) ENGINE = InnoDB; Note that currently only the InnoDB and BDB engines are transaction-safe. Furthermore, if an engine is not recognized by the create table statement or is not usable, the system will automatically fall back to MyISAM tables and thus support for foreign key constraints and transaction rollback can be silently lost if one is careless.
Final Thoughts
This paper cannot be a reference manual for database administration or management. However, it is hoped that it provides enough information that a system administrator can install the software base for other programs without running into many common problems.
Copyright
Information in this document, including URL and other Internet Web site references, is subject to change without notice and is provided for informational purposes only. The entire risk of the use or results from the use of this document remains with the user, and Microsoft Corporation makes no warranties, either express or implied. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. 2007 Microsoft Corporation. This work is licensed under the Microsoft Permissive License. The
Microsoft Permissive License is available here.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Microsoft, Windows, Windows XP, Windows Server, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are property of their respective owners.