
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Using MySQL with Apache
Let us understand how to use MySQL wth Apache −
Apache is a web server software which is developed and maintained by Apache software foundation. It is a software that takes requests from user to access a web page.
A few security checks are performed on the HTTP request and then takes the user to the web page. There are many programs that allow authentication of the users from a MySQL database. These programs can also be used to write the log files into a MySQL table.
The Apache logging format can be easily changed into readable mode by using MySQL, and putting the following lines of code into Apache’s 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 the above mentioned format into MySQL, the statement shown below can be used −
LOAD DATA INFILE '/local/access_log' INTO TABLE tbl_name FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\'
The name table should be created to have columns such that they correspond to those of the LogFormat line writes in the log file.
- Related Articles
- How to secure apache with using lets encrypt an open source ssl provider
- How to Setup Virtual Hosts with Apache Web Server on Linux
- Removing leading zeros from a String using apache commons library in Java
- How To Set Up Multiple SSL Host With A Single Apache Server
- Websockets Apache Server compatibility in HTML5
- Difference between Apache Kafka and Kinesis
- Difference between Apache Kafka and Flume
- Difference between Apache Kafka and JMS.
- Using variables with MySQL prepare statement
- How To Install Apache Maven on Ubuntu
- Using Update statement with TINYINT in MySQL?
- How to configure Apache for Python CGI Programming?
- What are the differences between Apache and Nginx?
- How To Configure mod_rewrite for Apache on CentOS 7
- How to Configure Nagios Server for Monitoring Apache Server
