Spec-Zone .ru
спецификации, руководства, описания, API

14.2.2.1. Creating the InnoDB Tablespace

Suppose that you have installed MySQL and have edited your option file so that it contains the necessary InnoDB configuration parameters. Before starting MySQL, verify that the directories you have specified for InnoDB data files and log files exist and that the MySQL server has access rights to those directories. InnoDB does not create directories, only files. Check also that you have enough disk space for the data and log files.

It is best to run the MySQL server mysqld from the command prompt when you first start the server with InnoDB enabled, not from mysqld_safe or as a Windows service. When you run from a command prompt you see what mysqld prints and what is happening. On Unix, just invoke mysqld. On Windows, start mysqld with the --console option to direct the output to the console window.

When you start the MySQL server after initially configuring InnoDB in your option file, InnoDB creates your data files and log files, and prints something like this:

InnoDB: The first specified datafile /home/heikki/data/ibdata1did not exist:InnoDB: a new database to be created!InnoDB: Setting file /home/heikki/data/ibdata1 size to 134217728InnoDB: Database physically writes the file full: wait...InnoDB: datafile /home/heikki/data/ibdata2 did not exist:new to be createdInnoDB: Setting file /home/heikki/data/ibdata2 size to 262144000InnoDB: Database physically writes the file full: wait...InnoDB: Log file /home/heikki/data/logs/ib_logfile0 did not exist:new to be createdInnoDB: Setting log file /home/heikki/data/logs/ib_logfile0 sizeto 5242880InnoDB: Log file /home/heikki/data/logs/ib_logfile1 did not exist:new to be createdInnoDB: Setting log file /home/heikki/data/logs/ib_logfile1 sizeto 5242880InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer createdInnoDB: Creating foreign key constraint system tablesInnoDB: Foreign key constraint system tables createdInnoDB: Startedmysqld: ready for connections

At this point InnoDB has initialized its tablespace and log files. You can connect to the MySQL server with the usual MySQL client programs like mysql. When you shut down the MySQL server with mysqladmin shutdown, the output is like this:

010321 18:33:34  mysqld: Normal shutdown010321 18:33:34  mysqld: Shutdown CompleteInnoDB: Starting shutdown...InnoDB: Shutdown completed

You can look at the data file and log directories and you see the files created there. When MySQL is started again, the data files and log files have been created already, so the output is much briefer:

InnoDB: Startedmysqld: ready for connections

If you add the innodb_file_per_table option to my.cnf, InnoDB stores each table in its own .ibd file, in the same MySQL database directory where the .frm file is created. See Section 5.4.1, "Managing InnoDB Tablespaces".