Compile and install mysql 5.5 or above

Source: Internet
Author: User

Mysql 5.5 and above are compiled and installed. The Community version of mysql 5.5 and above adopts cmake compilation and installation, and is no longer installed using the./configure make install tool of gnu autotools. 1. basic software, such as gcc, must be installed in both centos and debian systems: gcc * gcc-c ++ * autoconf * automake * zlib * libxml * ncurses-devel * libgcrypt * libtool * yum-y install apt-get install 2. install 1 Download Software wget http://www.cmake.org/files/v2.8/cmake-2.8.10.tar.gzwget http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.6/mysql-5.6.12.tar.gz Prepare 1cd/usr/local2mkdir mysql3cd mysql4mkdir data5groupadd mysql6useradd-r-g mysql mysql7mkdir/usr/local/mysql/data (data folder) 8 chown-R mysql. mysql/usr/local/mysql/data2 install the cmake compile parameters here view 01tar xzvf cmake-2.8.10.tar.gz02cd cmake-2.8.1003. /bootstrap04make05make install06cd mysql-5.6.1207cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql \ 08-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \ 09-DDEFAULT_CHARSET = utf8 \ 10-DDEFAULT_COLLATION = utf8_general_ci \ 11-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \ Users = 1 \ Users = 1 \ Users = 1 \ Users = 1 \ 16-DWITH_READLINE = yes \ 17-DENABLED_LOCAL_INFILE = 1 \ 18-DMYSQL_DATADIR =/usr/local/mysql/data \ Users = 33061make2make install 3. change the folder permission and initialize the database 1cd/usr/local/mysql2chown-R mysql. 3 chgrp-R mysql. copy the configuration file and start 01cp support-files/my-medium.cnf/etc/my. cnf02 # initialize table03chmod 755 scripts/mysql_install_db04 scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data/# specify user run 05 chown-R root. 06 chown-R mysql data07 08 nohup. /bin/mysqld_safe -- defaults-file =/etc/my. cnf & # Run 09 # Start 10cp support-files/mysql at startup. server/etc/init. d/mysql. server # System Service 1 chkconfig -- add mysql. server # when starting the instance, a Warning will be reported: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see documentation for more details ). please go to my. configure explicit_defaults_for_timestamp = true in the cnf file: 1. some italics of the autotools and CMAKE parameters during mysql compilation are commonly used (the following content is taken from the official mysql website) http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide The parameter configure option CMake indicates that the main installation directory -- prefix =/usr-DCMAKE_INSTALL_PREFIX =/usr mysqld directory -- libexecdir =/usr/sbin-DINSTALL_SBINDIR = sbin is relative to -- prefix, equivalent to/usr/sbin, do not add a prefix (the following mark is the same as above) data directory -- localstatedir =/var/lib/mysql-DMYSQL_DATADIR =/var/lib/mysql configuration file my. cnf directory -- sysconfdir =/etc/mysql-DSYSCONFDIR =/etc/mysql plug-in directory -- with-plugindir =/usr/lib64/mysql/plugin-DINSTALL_PLUGINDIR = lib64/mysql/plugin same as above man page Directory -- mandir =/usr/share/man-DINSTALL_MANDIR = share/mysql share the same data directory as above -- sharedstatedir =/usr/share/mysql-dinstall_1_dir = share aclocal/mysql. m4 installation directory library installation directory -- libdir =/usr/lib64/mysql-DINSTALL_LIBDIR = lib64/mysql same as Header installation directory -- includedir =/usr/include/mysql-DINSTALL_INCLUDEDIR = include/mysql same as the information document directory -- infodir =/usr/share/info-DINSTALL_INFODIR = share/info. The same as the storage engine is also installed as a plug-in, the configure method accepts the -- with-plugins parameter specified parameter method to install the plug-in using commas (,) or group names. However, in CMake, each storage engine is configured separately as a parameter. The following are commonly used: -DWITH_INNOBASE_STORAGE_ENGINE = 1 INNODB Engine-DWITH_ARCHIVE_STORAGE_ENGINE = 1 ARCHIVE engine-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 BLACKHOLE engine common cmake parameters (there may be some differences between MySQL versions) -DCMAKE_INSTALL_PREFIX = point to the mysql installation directory-DINSTALL_SBINDIR = sbin point to the executable file directory (prefix/sbin) -DMYSQL_DATADIR =/var/lib/mysql points to the mysql data file directory (/var/lib/mysql)-DSYSCONFDIR =/etc/mysql points to the mysql configuration file directory (/etc/mysql) -DINSTALL_PLUGINDIR = lib/mysql/plugin points to the plug-in directory (prefix/lib/mysql/plugin)-DINSTALL_MANDIR = share/man points to the man document directory (prefix/share/man) -dinstall_1_dir = share points to aclocal/mysql. m4 installation directory (prefix/share)-DINSTALL_LIBDIR = lib/mysql point to the object code library directory (prefix/lib/mysql) -DINSTALL_INCLUDEDIR = include/mysql points to the header file directory (prefix/include/mysql)-DINSTALL_INFODIR = share/info points to the info file storage directory (prefix/share/info) we recommend that you set prefix to the csv, myisam, myisammrg, heap, innobase, archive, and blackhole types related to/usrStorage Engine: -DWITH _ <ENGINE> _ STORAGE_ENGINE = 1 e. g.-DWITH_INNOBASE_STORAGE_ENGINE = Disabled = 1-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 if you want to disable support for an ENGINE:-DWITHOUT _ <ENGINE> _ STORAGE_ENGINE: -DWITHOUT_EXAMPLE_STORAGE_ENGINE = certificate = 1-DWITHOUT_PARTITION_STORAGE_ENGINE = 1Library-DWITH_READLINE = 1 enable readline library support (provides editable command lines)-DWITH_SSL = system enables ssl library support (Secure Sockets Layer) -DWITH_ZLIB = system enables libz library support (related to zib and gzib)-DWTIH_LIBWRAP = 0 disables libwrap Library (implements the common TCP packaging function and is used by network service daemon) -DMYSQL_TCP_PORT = 3306 specify the TCP port 3306-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock specifies mysql. sock path-DENABLED_LOCAL_INFILE = 1 enable local data import support-DEXTRA_CHARSETS = all enable additional character set types (all by default) -DDEFAULT_CHARSET = utf8 specify the default character set as utf8-DDEFAULT_COLLATION = utf8_general_ci set the default sorting rule (utf8_general_ci fast/utf8_unicode_ci accurate) -DWITH_EMBEDDED_SERVER = 1 compile embedded server support-DMYSQL_USER = mysql specified mysql user (mysql by default)-DWITH_DEBUG = 0 Disable debug (disabled by default) -DENABLE_PROFILING = 0 disable Profiling analysis (enabled by default) 2. mysql compilation error and solution Error 1: cocould NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) 1. run: yum-y install ncurses-devel ubuntu run: apt-get install libncurses5 libncurses5-dev 2. delete CMakeCache.txt and run cmake again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.