Team LiB
Previous Section Next Section

Chapter 10. The MySQL Data Directory

Conceptually, most relational database systems are broadly similar: They manage a set of databases, and each database includes a set of tables. But every system has its own way of organizing the data it manages, and MySQL is no exception. By default, all information managed by the MySQL server mysqld is stored under a location called the MySQL data directory. All databases are stored here, and so are the status and log files that provide information about the server's operation. If you have any administrative responsibilities for a MySQL installation, familiarity with the layout and use of the data directory is fundamental to carrying out your duties. You can also benefit from reading this chapter even if you don't perform any MySQL administration; it never hurts to have a better idea of how the server operates.

This chapter covers the following topics:

  • How to determine the location of the data directory. Because the data directory is so central to the operation of the MySQL server, you should know how to determine where it is located so that you can administer its contents effectively.

  • How the server organizes and provides access to the databases and tables it manages. This is important for setting up preventive maintenance schedules, and for performing crash recovery should table corruption ever occur.

  • What status and log files the server generates and what they contain. Their contents provide useful information about how the server is running, which is useful if you encounter problems.

  • How to change the default location or organization of the data directory. This can be important for managing the allocation of disk resources on your systemfor example, by balancing disk activity across drives or by relocating data to filesystems with more free space. You can also use this knowledge in planning placement of new databases.

For Unix systems, the chapter assumes the existence of a login account that is used for performing MySQL administrative tasks and for running the server. In this book, the user and group names for that account both are mysql. The reasons for using a designated login account for MySQL administration are discussed in "Running the Server Using an Unprivileged Login Account," in Chapter 11, "General MySQL Administration."

Many examples throughout this chapter denote the location of the MySQL data directory as DATADIR. You should interpret that as the location of the data directory for the server on your own machine.

    Team LiB
    Previous Section Next Section