- 論壇徽章:
- 0
|
[ 本帖最后由 chinafenghao 于 2013-02-25 10:51 編輯 ]
以前使用源代碼安裝過5.1Mysql,后來由于生產(chǎn)環(huán)境一直用RPM包安裝,所以漸漸的忽略了源代碼安裝,由于最近比較空閑,所以在網(wǎng)上搜索了一些相關(guān)的內(nèi)容,自己試驗(yàn)一下。<div>從新的文檔文檔上來看Mysql改變了編譯的方式,采用Cmake來編譯,在說明文檔里面有一些介紹,并且說明了從源代碼安裝Mysql的兩種源代碼方式,一個(gè)是標(biāo)準(zhǔn)的源代碼另外一個(gè)是開發(fā)版的源代碼安裝。</div><div><div> There are two methods for installing MySQL from source:</div><div><br></div><div> * Use a standard MySQL source distribution. To obtain a standard</div><div> distribution, see Section 2.1.3, "How to Get MySQL." For</div><div> instructions on building from a standard distribution, see</div><div> Section 2.9.2, "Installing MySQL from a Standard Source</div><div> Distribution."</div><div> Standard distributions are available as compressed tar files,</div><div> Zip archives, or RPM packages. Distribution files have names</div><div> of the form mysql-VERSION.tar.gz, mysql-VERSION.zip, or</div><div> mysql-VERSION.rpm, where VERSION is a number like 5.6.3. File</div><div> names for source distributions can be distinguished from those</div><div> for precompiled binary distributions in that source</div><div> distribution names are generic and include no platform name,</div><div> whereas binary distribution names include a platform name</div><div> indicating the type of system for which the distribution is</div><div> intended (for example, pc-linux-i686 or winx64).</div><div><br></div><div> * Use a MySQL development tree. Development trees have not</div><div> necessarily received the same level of testing as standard</div><div> release distributions, so this installation method is usually</div><div> required only if you need the most recent code changes. For</div><div> information on building from one of the development trees, see</div><div> Section 2.9.3, "Installing MySQL from a Development Source</div><div> Tree."</div></div><div>這兩種安裝方式都是需要以下軟件支持:</div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; ">libncurses<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">bison<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">cmake<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">libaio</span></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">perl</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">tar 等</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">2.源代碼安裝Mysql</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">2.1標(biāo)準(zhǔn)源代碼安裝Mysql</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">2.1.1安裝前準(zhǔn)備工作</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">安裝libncurses</span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="line-height: normal; ">tar xzf ncurses-5.7.tar.gz
cd ncurses-5.7
./configure --prefix=/usr/ncurses
make
make install</span></span></font></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; ">安裝bison</span></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">首先確認(rèn)m4安裝位置,把它的位置放到變量中/etc/profile </span></font></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">PATH=$PATH:/usr/bin/m4 (一般m4的位置在/usr/bin/m4 下面不需要額外設(shè)置</span></font><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; ">)</span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; "><span class="Apple-style-span" style="line-height: normal; ">tar -xvzf bison-2.3.tar.gz
cd bison-2.3
./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/lib
make
make install</span></span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; ">安裝cmake</span></div><div><font class="Apple-style-span" color="#333333" face="Tahoma, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 12px;">地址為</span></font><a href="http://www.cmake.org/" target="_blank">http://www.cmake.org/</a> 是一個(gè)開源的編譯軟件</div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; "> tar xzf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure --prefix=/usr/cmake
make
make instal</span></div><div>安裝libaio 其實(shí)只需要解壓即可</div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; ">cd /usr
wget [url]http://www.morphisms.net/~wkj/download/libaio.tbz[/url]
bunzip2 libaio.tbz
tar xf libaio.tar</span></div><div>2.2安裝Mysql5.6</div><div><div id="codeText" class="codeText"><ol style="margin:0 1px 0 0;padding:5px 0;" start="1" class="dp-css"><li>groupadd mysql</li><li>
useradd -r -g mysql mysql</li><li>
tar -zxvf mysql-5.6.2-m5.tar.gz</li><li>
cd mysql-5.6.2-m5</li><li>
/usr/cmake/bin/cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data/ -DCMAKE_INSTALL_PREFIX=/usr/local/mysqlDCURSES_LIBRARY=/usr/ncurses/lib/libncurses.a -DCURSES_INCLUDE_PATH=/usr/ncurses/include/ -DHAVE_LIBAIO_H=/usr/libaio/include/ -DINSTALL_LAYOUT=STANDALONE -DENABLED_PROFILING=ON -DMYSQL_MAINTAINER_MODE=OFF -DWITH_DEBUG=OFF</li><li>
make</li><li>
make install</li><li>cd /usr/local/mysql</li><li>chown -R mysql .</li><li>chgrp -R mysql .</li><li>scripts/mysql_install_db --user=mysql</li><li>chown -R root .</li><li>chown -R mysql data</li><li>cp support-files/my-medium.cnf /etc/my.cnf</li><li>bin/mysqld_safe --user=mysql &</li><li><li>[root@Snort-test local]# mysql -uroot -p</li><li>Enter password: </li><li>Welcome to the MySQL monitor. Commands end with ; or \g.</li><li>Your MySQL connection id is 1</li><li>Server version: 5.6.2-m5-log Source distribution</li><li><br></li><li>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</li><li><br></li><li>mysql> show databases;</li><li>+--------------------+</li><li>| Database |</li><li>+--------------------+</li><li>| information_schema | </li><li>| mysql | </li><li>| performance_schema | </li><li>| test | </li><li>+--------------------+</li><li>4 rows in set (0.00 sec)</li><li><br></li><li>mysql> </li><li>#完成安裝</li></li><li><br></li></ol></div></div><div><br></div><div>2.3開發(fā)包的源代碼安裝</div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div> |
|