•How to use the LAST_INSERT_ID()  function to find the row that contains the most recent AUTO_INCREMENT  value: Section 12.16, “Information Functions” . 

•Setting the AUTO_INCREMENT  value to be used: Section 5.1.8, “Server System Variables” . 

•Section 15.6.1.6, “AUTO_INCREMENT Handling in InnoDB” 

• AUTO_INCREMENT  and replication: Section 17.5.1.1, “Replication and AUTO_INCREMENT” . 

•Server-system variables related to AUTO_INCREMENT  ( auto_increment_increment  and auto_increment_offset ) that can be used for replication: Section 5.1.8, “Server System Variables” . 

## 3.7 Using MySQL with Apache 

There are programs that let you authenticate your users from a MySQL database and also let you write your log files into a MySQL table. 

You can change the Apache logging format to be easily readable by MySQL by putting the following into the Apache configuration file: 

LogFormat \ ""%h",%{%Y%m%d%H%M%S}t,%>s,"%b","%{Content-Type}o", \ "%U","%{Referer}i","%{User-Agent}i"" 

To load a log file in that format into MySQL, you can use a statement something like this: 

LOAD DATA INFILE ’ /local/access_log ’ INTO TABLE tbl_name FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’"’ ESCAPED BY ’\\’ 

The named table should be created to have columns that correspond to those that the LogFormat  line writes to the log file. 

