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.