MySQL Compile and install

Source: Internet
Author: User

Mysql A MySQL compile and install

1. Installation environment and preparation of installation packages

MySQL installation environment needs to occupy a lot of memory, so the number of CPU cores added to two, the memory to add at least 2048

Installation package:

650) this.width=650; "title=" wps18f5.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18f5.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/6C/wKioL1ffkj-TuSFWAAAb_ W23evk333.jpg "" 219 "height=" 183 "/> Install this is to compile with

650) this.width=650; "title=" wps18f6.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18f6.tmp "src=" http://s3.51cto.com/wyfs02/M02/87/6C/wKioL1ffkj-jvQJpAAAW_ Kskuw0148.jpg "" 223 "height=" 162 "/>mysql installation package

2. Due to the expansion of memory before the transfer, so to expand capacity, if the root partition in the form of LVM can be expanded, this is the installation system to pay attention to, as far as possible in the installation of the system will be the root partition to become LVM, so as to add capacity, because this time the machine did not take this way, So you can only re-add a virtual disk, set it to LVM mode, and attach it to a directory on this machine. As the final result:

650) this.width=650; "title=" wps18f7.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18f7.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/70/ Wkiom1ffkkchq5zsaabkjefudge488.jpg "" 225 "height=" 244 "/>

650) this.width=650; "title=" wps18f8.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18f8.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/70/ Wkiom1ffkkgz2zn-aaat5jvgvnm604.jpg "" 244 "height="/>

3. In the Mount directory, move the installation package to the Mount directory, unzip the MySQL package, and install the CMake.

650) this.width=650; "title=" wps18f9.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18f9.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/6C/ Wkiol1ffkkkdl5bxaaaqp2cxduq816.jpg "" 244 "height="/>

4. Cut into the MySQL unzip directory and start compiling the installation

Cmake

-dcmake_install_prefix=/usr/local/lnmp/mysql-dmysql_datadir=/usr/local/lnmp/mysql/data-dmysql_unix_addr=/usr/ Local/lnmp/mysql/data/mysql.sock-dwith_myisam_storage_engine=1

-dwith_innobase_storage_engine=1

-ddefault_charset=utf8

-ddefault_collation=utf8_general_ci

-dextra_charsets=all-dwith_boost=boost/boost_1_59_0/

There will be some missing dependencies after CMake, pay attention to these dependencies on the package, what is missing, what to pack.

650) this.width=650; "title=" wps18fa.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18fa.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/70/ Wkiom1ffkkaxokcdaaa9b2afm-k936.jpg "" 244 "height=" 156 "/>

Yum Install-y gcc-c++

Yum Install-y ncurses-devel

Yum Install-y Bison

5. After the modification, recompile, delete the previous cache and recompile

Rm-f CMakeCache.txt

two. MySQL initialization

1. Create a new MySQL user

650) this.width=650; "title=" wps18fb.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18fb.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/6C/ Wkiol1ffkkfbvy4paaaanfnat9e240.jpg "" 244 "height="/>

Useradd-u 27-d/usr/local/lnmp/mysql/mysql

650) this.width=650; "title=" wps18fc.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18fc.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/70/ Wkiom1ffkkeikpuwaaaphx1y84g722.jpg "" 244 "height="/>

Although the error is shown here, CAT/ETC/PASSWD can still see the user

650) this.width=650; "title=" wps18fd.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps18fd.tmp "src=" http://s3.51cto.com/wyfs02/M02/87/6C/ Wkiol1ffkkjgksihaaal4zizieu630.jpg "" 244 "height="/>

Build User Complete

2. Modify the environment variable so that MySQL can open the operation under any path

650) this.width=650; "title=" wps190e.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps190e.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/70/ Wkiom1ffkkjydobuaaazobku6vm920.jpg "" 244 "height="/>

650) this.width=650; "title=" wps190f.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps190f.tmp "src=" Http://s3.51cto.com/wyfs02/M02/87/70/wKiom1ffkknhmoE8AAASYa_ Jz2y722.jpg "" 244 "height=" "/>

Source makes it effective, but note the difference between source and SH

3. Copy the MySQL configuration file

650) this.width=650; "title=" wps1910.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1910.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/70/ Wkiom1ffkkrwdcljaaakrtm1km0810.jpg "" 244 "height=" "/>

4. Modify the user and group of files under MySQL

650) this.width=650; "title=" wps1911.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1911.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/70/ Wkiom1ffkkqcbmluaaas2oblz0w431.jpg "" 244 "height=" 118 "/>

5. Initialize MySQL

Mysqld--user=mysql--initialize

650) this.width=650; "title=" wps1912.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1912.tmp "src=" http://s3.51cto.com/wyfs02/M02/87/6C/ Wkiol1ffkk6tpqtiaaazcg7eafy417.jpg "" 244 "height=" 118 "/>

The build is given a temporary password, followed by a reset:

Hfq>o7*b>prq

Then turn on MySQL

650) this.width=650; "title=" wps1913.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1913.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/70/ Wkiom1ffkk-qir5haaalsd-sznm239.jpg "" 244 "height="/>

6. Re-modify file permissions under MySQL

650) this.width=650; "title=" wps1914.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1914.tmp "src=" Http://s3.51cto.com/wyfs02/M00/87/6C/wKioL1ffkk_ Tbifmaaaowloyq6q500.jpg "" 244 "height=" 146 "/>

The final result is to modify it to look like this, note that the files under data belong to MySQL

650) this.width=650; "title=" wps1915.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1915.tmp "src=" http://s3.51cto.com/wyfs02/M00/87/70/ Wkiom1ffkldgauu0aaax27iki-o136.jpg "" 244 "height=" 118 "/>

650) this.width=650; "title=" wps1916.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1916.tmp "src=" http://s3.51cto.com/wyfs02/M02/87/6C/ Wkiol1ffklhjbpx5aaaxebk148m072.jpg "" 244 "height="/>

Then turn on mysqld.

7. Initialize the change password

Mysql_secure_installation #按提示完成 MySQL security settings, recommended for production environments

650) this.width=650; "title=" wps1917.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" wps1917.tmp "src=" http://s3.51cto.com/wyfs02/M01/87/70/ Wkiom1ffklkwdc-yaaaocnzzwuw755.jpg "" 244 "height="/>

The password you set is preferably a case-and-letter number, and then all you have to answer is Y.

8. Log in to MySQL

650) this.width=650; "title=" wps1927.tmp "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" wps1927.tmp "src=" http://s3.51cto.com/wyfs02/M02/87/70/wKiom1ffklODWtS_ Aaamo739igw890.jpg "" 244 "height=" 167 "/>

MySQL Compile and install

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.