Contents./configure \ -- prefix...
Mysql compilation and installation and compilation parameters
Add a mysql group and a mysql User
[Root @ centos mysql] # groupadd mysql
[Root @ centos mysql] # useradd-g mysql
Compilation and installation
Tar-zxvf mysql-5.1.35.tar.gz
./Configure \
-- Prefix =/usr/local/mysql \
-- Localstatedir =/data/mysql/data \ mysql data directory
-- Enable-aggreger \ allows the use of the Assembly mode (to optimize performance)
-- With-unix-socket-path =/tmp/mysql. sock use unix socket link to improve
-- Enable-thread-safe-client \ compile client thread security in thread mode
-- With-client-ldflags =-all-static \ compile the client in pure static mode
-- With-mysqld-ldflags =-all-static compile server in pure static mode
-- With-plugins = partition, innobase supports engines
-- With-charset = utf8
-- With-collation = utf8_general_ci
-- With-extra-charsets = all
-- With-big-tables supports large database tables
-- Remove debug mode from without-debug
Make & make install
Chmod + w/opt/mysql
Chown-R mysql: mysql/opt/mysql/
/Opt/mysql/bin/mysql_install_db -- user = mysql
/Opt/mysql/bin/mysqld_safe -- user = mysql &
Mysql directory permission settings
Mkdir/usr/local/mysql/var
Mkdir/var/run/mysqld
Chmod + w/usr/local/mysql/
Chown-R mysql: mysql/usr/local/mysql/
Chown-R mysql: mysql/var/run/mysqld
Cp/usr/local/mysql/share/mysql/my-innodb-heavy-4G.cnf/etc/my. cnf
Initialize a database table as a mysql User
/Usr/local/mysql/bin/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/data/mysql/data -- user = mysql
-- Datadir =/data/mysql/data define the mysql data storage directory
Note: If you define a data directory to another directory, you must first modify the/etc/my. cnf file and add the following two lines
[Mysqld]
# Generic configuration options
Port = 3306
Socket =/tmp/mysql. sock
# Wb config
Basedir =/usr/local/mysql literal mysql program directory
Datadir =/data1/mysql/data Definition data Directory
Initialize the table for the database. Otherwise, an error will be reported when the mysql database is started.
Start mysql service
/Usr/local/mysql/bin/mysqld_safe -- user = mysql -- datadir =/data/mysql/data (specify the Database Directory)
/Usr/local/mysql/bin/mysqld_safe -- user = mysql 2> & 1>/dev/null &
1.-static 13%
-- With-client-ldflags =-all-static
-- With-mysqld-ldflags =-all-static
Static links increase performance by 13%
2.-pgcc 1%
CFLAGS = "-O3-mpentiumpro-mstack-align-double" CXX = gcc \
CXXFLAGS = "-O3-mpentiumpro-mstack-align-double \
-Felide-constructors-fno-exceptions-fno-rtti"
For Inter processors, use pgcc to improve performance by 1%
3. the Unix Socket 7.5%
-- With-unix-socket-path =/usr/local/mysql/tmp/mysql. sock
Using unix socket links improves performance by 7.5%, so mysql Performance in windows is certainly inferior to that in unix
4. -- enable-cycler
Allow Assembly mode (optimized performance)
Below is the overall compilation file
Compile code
CFLAGS = "-O3" CXX = gcc CXXFLAGS = "-O3-felide-constructors \
-Fno-exceptions-fno-rtti-fomit-frame-pointer-ffixed-ebp"
./Configure \
-- Prefix =/usr/local/mysql -- enable-validator \
-- With-mysqld-ldflags =-all-static
-- With-client-ldflags =-all-static
-- With-unix-socket-path =/usr/local/mysql/tmp/mysql. sock
-- With-charset = utf8
-- With-collation = utf8_general_ci
-- With-extra-charsets = all
During MySQL compilation, the following message is displayed:
/Bin/rm: cannot remove 'libtoolt': No such file or directory
Solution:
1. check whether libtool is installed. if not, install libtool first.
# Yum-y install libtool
2. execute the following three commands:
# Autoreconf -- force -- install
# Libtoolize -- automake -- force
# Automake -- force -- add-missing
CFLAGS = "-O3" CXX = gcc CXXFLAGS = "-O3-felide-constructors-fno-exceptions-fno-rtti-fomit-frame-pointer-ffixed-ebp ". /configure -- prefix =/usr/local/mysql -- enable-validator -- with-mysqld-ldflags =-all-static -- with-client-ldflags =-all-static --- unix-socket-path =/tmp/mysql. sock -- with-charset = utf8 -- with-collation = utf8_general_ci -- with-extra-charsets = all -- with-pthread -- with-plugins = all
Common apache compilation parameters
View source code print help 1 prefix specified installation directory
2 enable-rewrite supports URL rewriting
3 enable-deflate supports web page compression
4 enable-speling to correct common URL spelling errors
5 enable-ssl SSL/TLS support (mod_ssl)
6 with-module loading module
Mysql compilation parameters
View source code printing help 1 enable-validator uses some character functions to compile the version
2 with-extra-charsets = complex uses the default character set (none, complex, all, or selected from the above settings)
3 enable-thread-safe-client to allow the client to support threads
4 with-big-tables support for large tables
5 with-readline Use system readline instead of bundled copy
6 with-ssl Include SSL support
7. Compile with-embedded-server into embedded MySQL library (libmysqld.)
8 enable-local-infile: allows mysql to import data from a local file to a database.
9 with-plugins = innobase storage engine
10 with-charset = utf8 set the default character set
11 with-collation = utf8_general_ci set character set verification rules
Common PHP compilation parameters
View the source code print help 1 with-config-file-path to specify the php. ini location
2 with-apxs2 integration apache, apxs function is to use the LoadModule command in mod_so, load the specified module to apache, require apache to open the SO Module
3 with-mysql installation directory, support for mysql
4 with-mysqli file directory, optimized support
5 with-iconv-dir iconv function, conversion between character sets
6. support for freetype library with-freetype-dir
7. support for jpeg images with-jpeg-dir
8 with-png-dir open support for png images
9. support for opening zlib library with-zlib
10 support opening libxml2 library with-libxml-dir
11 enable-xml support for opening xml
12 enable-inline-optimization thread
13 support for the curl browser tool with-curl
14 with-curlwrappers use the curl tool to open the url Stream
15 enable-mbregex enable support for mbregex
16 enable-mbstring multi-byte, string supported
17 with-mcrypt algorithm
18. support for opening the gd library with-gd
19 enable-gd-native-ttf supports TrueType string function library
20 with-openssl support, used for encrypted transmission
21 with-mhash algorithm
22 enable-pcntl freeTDS is required. it may be used only when mssql is linked.
23 enable-sockets support enabling sockets
24 with-ldap Include LDAP support
25 with-ldap-sasl LDAP: Include Cyrus SASL support
26 with-xmlrpc open the C language of xml-rpc
27 enable-zip open support for zip
28 enable-soap Enable SOAP support
29 with-gettext open gnu's gettext support, used by the encoding library
30 -----------------------------------------------------------
31 enable-track-vars
32 is useful in php web scripts and tracking php variables in GET/POST/Cookie. Probably because of security reasons, this compilation option has been replaced by a newer version of php.