- 论坛徽章:
- 0
|
[ 本帖最后由 chinafenghao 于 2013-02-25 10:51 编辑 ]
以前使用源代码安装过5.1Mysql,后来由于生产环境一直用RPM包安装,所以渐渐的忽略了源代码安装,由于最近比较空闲,所以在网上搜索了一些相关的内容,自己试验一下。<div>从新的文档文档上来看Mysql改变了编译的方式,采用Cmake来编译,在说明文档里面有一些介绍,并且说明了从源代码安装Mysql的两种源代码方式,一个是标准的源代码另外一个是开发版的源代码安装。</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标准源代码安装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安装前准备工作</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;">首先确认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 下面不需要额外设置</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> 是一个开源的编译软件</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 其实只需要解压即可</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开发包的源代码安装</div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div> |
|