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:
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.