On Windows, you can create a symlink using the mklink  command. This command requires administrative privileges. 

1. Change location into the data directory: 

C:\> cd \path	o\datadir 

2. In the data directory, create a symlink named mydb  that points to the location of the database directory: 

C:\> mklink /d mydb D:\data\mydb 

After this, all tables created in the database mydb  are created in D:\data\mydb . 

## 8.12.3 Optimizing Memory Use 

## 8.12.3.1 How MySQL Uses Memory 

MySQL allocates buffers and caches to improve performance of database operations. The default configuration is designed to permit a MySQL server to start on a virtual machine that has approximately 512MB of RAM. You can improve MySQL performance by increasing the values of certain cache and buffer-related system variables. You can also modify the default configuration to run MySQL on systems with limited memory. 

The following list describes some of the ways that MySQL uses memory. Where applicable, relevant system variables are referenced. Some items are storage engine or feature specific. 

•The InnoDB  buffer pool is a memory area that holds cached InnoDB  data for tables, indexes, and other auxiliary buffers. For efficiency of high-volume read operations, the buffer pool is divided into pages that can potentially hold multiple rows. For efficiency of cache management, the buffer pool is implemented as a linked list of pages; data that is rarely used is aged out of the cache, using a variation of the LRU algorithm. For more information, see Section 15.5.1, “Buffer Pool” . 

The size of the buffer pool is important for system performance: 

• InnoDB  allocates memory for the entire buffer pool at server startup, using malloc()  operations. The innodb_buffer_pool_size  system variable defines the buffer pool size. Typically, a recommended innodb_buffer_pool_size  value is 50 to 75 percent of system memory. innodb_buffer_pool_size  can be configured dynamically, while the server is running. For more information, see Section 15.8.3.1, “Configuring InnoDB Buffer Pool Size” . 

•On systems with a large amount of memory, you can improve concurrency by dividing the buffer pool into multiple buffer pool instances. The innodb_buffer_pool_instances  system variable defines the number of buffer pool instances. 

•A buffer pool that is too small may cause excessive churning as pages are flushed from the buffer pool only to be required again a short time later. 

•A buffer pool that is too large may cause swapping due to competition for memory. 

•The storage engine interface enables the optimizer to provide information about the size of the record buffer to be used for scans that the optimizer estimates are likely to read multiple rows. The buffer size can vary based on the size of the estimate. InnoDB  uses this variable-size buffering capability to take advantage of row prefetching, and to reduce the overhead of latching and B-tree navigation. 

•All threads share the MyISAM  key buffer. The key_buffer_size  system variable determines its size. 

For each MyISAM  table the server opens, the index file is opened once; the data file is opened once for each concurrently running thread that accesses the table. For each concurrent thread, a table structure, 

