LAMP Mysql source code configuration and installation, lampmysql source code

Source: Internet
Author: User

LAMP Mysql source code configuration and installation, lampmysql source code
MySQL is a relational database management system developed by MySQL AB in Sweden. It is currently a product of Oracle. MySQL is one of the most popular Relational Database Management systems. In terms of WEB applications, MySQL is the best RDBMS (Relational Database Management System) application software. MySQL is a relational database management system. Relational databases store data in different tables, rather than placing all data in a large warehouse. This increases the speed and flexibility. The SQL language used by MySQL is the most common standard language for accessing databases. MySQL adopts the dual Authorization Policy, which is divided into community edition and commercial edition. because of its small size, fast speed, and low total cost of ownership, especially open source code, generally, MySQL is used as the website database for the development of small and medium websites. Due to its superior performance, the Community edition works with PHP and Apache to form a good development environment.

Https://dev.mysql.com/doc/refman/5.7/en/source-installation.html # mysql official website, install Mysql source code, rely on Cmake

Download and install Cmake

[root@localhost1 cmake-3.9.6]# wget https://cmake.org/files/v3.9/cmake-3.9.6.tar.gz[root@localhost1 cmake-3.9.6]# tar zxf cmake-3.9.6.tar.gz [root@localhost1 cmake-3.9.6]# cd cmake-3.9.6[root@localhost1 cmake-3.9.6]# ./configure [root@localhost1 cmake-3.9.6]# gmake[root@localhost1 cmake-3.9.6]# gmake install

[Root @ localhost1 cmake-3.9.6] # which gmake
/Usr/bin/gmake

Components that must be installed before Mysql Installation

yum -y install gcc* libaio* ncurses-develgroupadd mysqluseradd mysql -s /sbin/nologin -M -g mysqlmkdir /opt/mysql-5.7.21/data -pmkdir /opt/mysql-5.7.21/tmp -pchown -R mysql.mysql /opt/mysql-5.7.21chmod 750 -R /opt/mysql-5.7.21
Https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html Mysql official website compilation parameters details
-DCMAKE_INSTALL_PREFIX = dir_name: Installation Base directory. This value can be set using the -- basedir option when the server is started. -DMYSQL_DATADIR = dir_nameMySQL data directory location. This value can be set by using the -- datadir option when the server is started. -DMYSQL_UNIX_ADDR = file_name the server listens to the Unix socket file path connected by the socket. This must be an absolute path name. The default value is/tmp/mysql. sock. This value can be set using the -- socket option when the server is started. -DDEFAULT_CHARSET = charset_name server character set. By default, MySQL uses the latin1 (cp1252 Western Europe) Character Set. Charset_name can be binary, armscii8, ascii, big5, cp1250, cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8, eucjpms, euckr, gb2312, gbk, keys, greek, hebrew, hp8, keybcs2, keys, keys, latin1, latin2, latin5, latin7, macce, macroman, sjis, swe7, tis620, ucs2, ujis, utf8, utf8mb4, utf16, utf16le, utf32. The allowed character sets are listed as CHARSETS_AVAILABLE values in the cmake/character_sets.cmake file. This value can be set by using the -- character_set_server option when the server is started. -DDEFAULT_COLLATION = collation_name: organize the server. By default, MySQL uses latin1_swedish_ci. Use the show collation statement to determine the available sorting rules for each character set. This value can be set by using the -- collation_server option when the server is started.

Cmake-DCMAKE_INSTALL_PREFIX =/opt/mysql-5.7.21-DMYSQL_DATADIR =/opt/mysql-5.7.21/data-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-since =/opt/mysql-5.7.21/tmp/mysql. sock-DWITH_BOOST =/opt/boost this parameter is required-DWITH_DEBUG = 1 # It is not written above

Error summary:

When MySQL5.7.17 is in cmake, the following Error is reported: Click (here) to collapse or open CMake Error at cmake/boost. cmake: 81 (MESSAGE): You can download it with-DDOWNLOAD_BOOST = 1-DWITH_BOOST = This CMake script will look for boost in. if it is not there, it will download and unpack it (in that directory) for you. if you are inside a firewall, you may need to use an http proxy: export http_proxy = http://example.com: 80 Call Stack (most recent call first): cm Ake/boost. cmake: 238 (COULD_NOT_FIND_BOOST)CMakeLists.txt: 455 (INCLUDE) -- refreshing incomplete, errors occurred! See also "/root/MySQL software/mysql-5.7.17/CMakeFiles/CMakeOutput. log ". see also "/root/mysqlsoftware/mysql-5.7.17/CMakeFiles/CMakeError. log ". solution: 1. create a boost folder mkdir-p/usr/local/boost2. under/usr/local to enter the newly created folder and download boost wget tar-xvzf boost_1_59_0.tar.gz4. continue cmake and add the red cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-nodes = ON \-keys = 1 \-keys = 1 \-keys = 1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1 \-DWITH_PARTITION_STORAGE_ENGINE = 1 \-runtime = 1 \-DCOMPILATION_COMMENT = 'mysqlma' \-DWITH_READLINE = ON \-DWITH_BOOST =/usr/local/boost \-DSYSCONFDIR =/data/mysqldata/3306 \-DMYSQL_UNIX_ADDR =/data/mysqldata/3306/mysql. sock
-The DWITH_BOOST = path_nameBoost library is required to build MySQL. These CMake options can control the source location of the library and whether to automatically download it:-DWITH_BOOST = path_name specifies the directory location of the Boost library. You can also specify the Boost location by setting the BOOST_ROOT or WITH_BOOST environment variable. From MySQL 5.7.11, IT-DWITH_BOOST = system is allowed, and indicates that the correct version of Boost is installed on the compiling host at the standard location. In this case, the Boost version is used instead of any version contained in the MySQL source code release. -DDOWNLOAD_BOOST = bool: Specifies whether to download the Boost source if the specified position does not exist. The default value is OFF. -DDOWNLOAD_BOOST_TIMEOUT = timeout (in seconds) for downloading the Boost library from seconds ). The default value is 600 seconds. For example, if you usually build MySQL and place the object output in the subdirectory of the bldMySQL source code tree, you can use Boost to build it, as shown below: mkdir bldcd bldcmake .. -DDOWNLOAD_BOOST = ON-DWITH_BOOST = $ HOME/my_boost this will cause Boost to be downloaded to the directory in your main directory of my_boost. If the required Boost version already exists, do not download it. If the required Boost version is changed, a newer version will be downloaded. If Boost has been installed locally and the compiler finds the Boost header file, you may not need to specify the preceding CMake option. However, if the Boost version required by MySQL is changed and the locally installed version has not been upgraded, a build problem may occur. The CMake option should give you a successful build. The above allows you to download Boost to the specified location. When the required Boost version is changed, you need to delete the bld folder, recreate the folder, and then execute the cmake step again. Otherwise, the new Boost version may fail to be downloaded and compilation may fail.
Solution to http://blog.csdn.net/cryhelyxx/article/details/47610247 Problems
Bin/mysqld -- initialize -- user = mysql initializes mysql. The specified user -- initialize will automatically generate the password
cp /opt/mysql-5.7.21/support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
echo 'export PATH=/application/mysql/bin:$PATH'>>/etc/profile
If you do not know the mysql root Password, change the password [root @ cairui mysql] # bin/mysqld_safe -- skip-grant-tables & enter the command update mysql in mysql. user set authentication_string = password ('root') where user = 'root ';
Add to boot and start [root @ cairui ~] # Chkconfig mysqld on
Http://www.bubuko.com/infodetail-2167283.html does not need an explanation of/etc/my. cnf

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.