1. Compile MySQL5.0
#. /Configure -- prefix =/usr/local/mysql -- localstatedir =/usr/local/mysql/data -- enable-thread-safe-client -- enable-local-infile -- enable-validator -- enable-community-features -- enable-profiling -- with-client-ldflags =-all-static -- with-mysqld-ldflags =-all-static -- with-charset = utf8 -- -collation = utf8_general_ci -- with-extra-charsets = all -- with-mysqld-user = mysql -- without-embedded-server -- with-big-tables -- with-server-suffix =- community -- with-unix-socket-path =/usr/local/mysql/etc/mysql. sock -- without-debug -- without-man -- without-docs -- without-example -- with-csv-storage-engine -- with-blackhole-storage-engine -- with-federated-storage- engine
Configuration after compilation (operations in other versions are similar)
# Cd/usr/local/mysql
# Cp share/mysql/my-medium.cnf/etc/my. cnf
# Mkdir etc
Install database files
#./Bin/mysqld_install_db
# Chown-R mysql: mysql.
#./Bin/mysqld_safe -- user = mysql &
Ii. Compile MySQL5.1
#. /Configure -- prefix =/usr/local/mysql5.1 -- localstatedir =/usr/local/mysql5.1/data -- enable-thread-safe-client -- enable-local-infile -- enable-encryption er -- enable-community-features -- enable-profiling -- with-client-ldflags =-all-static -- with-mysqld-ldflags =-all-static -- with-charset = utf8 -- -collation = utf8_general_ci -- with-extra-charsets = all -- with-mysqld-user = mysql -- without-embedded-server -- with-big-tables -- with-server-suffix =- community -- with-unix-socket-path =/usr/local/mysql/etc/mysql. sock -- without-debug -- without-man -- without-docs -- with-plugins = partition, blackhole, csv, federated, heap, innobase, myisam
To compile innodb_plugin, You need to upgrade the gcc version.
# Export CFLAGS = "-O2-DHAVE_DLOPEN = 1"
# Export CXXFLAGS = "-O2-DHAVE_DLOPEN = 1"
#. /Configure -- prefix =/usr/local/mysql -- localstatedir =/usr/local/mysql/data -- enable-thread-safe-client -- enable-local-infile -- enable-validator -- enable-community-features -- enable-profiling -- with-charset = utf8 -- with-collation = utf8_general_ci -- with-extra-charsets = all -- with-mysqld-user = mysql -- -embedded-server -- with-big-tables -- with-server-suffix =-community -- with-unix-socket-path =/usr/local/mysql/etc/mysql. sock -- without-debug -- without-man -- without-docs -- with-plugins = partition, blackhole, csv, federated, heap, innobase, innodb_plugin, myisam -- disable-static
To use innodb_plugin, edit the configuration file my. cnf and add the following content:
# Disable old innodb
Ignore_builtin_innodb
# Enable innodb plugin
Plugin_load = innodb = ha_innodb_plugin.so
# Set a new data file format and support table data and index compression
Innodb_file_format = barracuda
# Using independent tablespaces
Innodb_file_per_table
# Strict check Mode
Innodb_strict_mode = 1
Iii. Compile MySQL5.5
MySQL5.5 uses CMake for compilation. It is a cross-platform compilation tool.
# Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/usr/local/mysql/data-DSYSCONFDIR =/usr/local/mysql/etc-DDEFAULT_CHARSET = utf8-character = /usr/local/mysql/etc/mysql. sock