免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2906 | 回复: 1

【分享】源代码安装Mysql5.6 [复制链接]

论坛徽章:
0
发表于 2011-12-21 08:42 |显示全部楼层
[ 本帖最后由 chinafenghao 于 2013-02-25 10:51 编辑 ]

以前使用源代码安装过5.1Mysql,后来由于生产环境一直用RPM包安装,所以渐渐的忽略了源代码安装,由于最近比较空闲,所以在网上搜索了一些相关的内容,自己试验一下。<div>从新的文档文档上来看Mysql改变了编译的方式,采用Cmake来编译,在说明文档里面有一些介绍,并且说明了从源代码安装Mysql的两种源代码方式,一个是标准的源代码另外一个是开发版的源代码安装。</div><div><div>&nbsp;There are two methods for installing MySQL from source:</div><div><br></div><div>&nbsp; &nbsp; &nbsp;* Use a standard MySQL source distribution. To obtain a standard</div><div>&nbsp; &nbsp; &nbsp; &nbsp;distribution, see Section 2.1.3, "How to Get MySQL." For</div><div>&nbsp; &nbsp; &nbsp; &nbsp;instructions on building from a standard distribution, see</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Section 2.9.2, "Installing MySQL from a Standard Source</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Distribution."</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Standard distributions are available as compressed tar files,</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Zip archives, or RPM packages. Distribution files have names</div><div>&nbsp; &nbsp; &nbsp; &nbsp;of the form mysql-VERSION.tar.gz, mysql-VERSION.zip, or</div><div>&nbsp; &nbsp; &nbsp; &nbsp;mysql-VERSION.rpm, where VERSION is a number like 5.6.3. File</div><div>&nbsp; &nbsp; &nbsp; &nbsp;names for source distributions can be distinguished from those</div><div>&nbsp; &nbsp; &nbsp; &nbsp;for precompiled binary distributions in that source</div><div>&nbsp; &nbsp; &nbsp; &nbsp;distribution names are generic and include no platform name,</div><div>&nbsp; &nbsp; &nbsp; &nbsp;whereas binary distribution names include a platform name</div><div>&nbsp; &nbsp; &nbsp; &nbsp;indicating the type of system for which the distribution is</div><div>&nbsp; &nbsp; &nbsp; &nbsp;intended (for example, pc-linux-i686 or winx64).</div><div><br></div><div>&nbsp; &nbsp; &nbsp;* Use a MySQL development tree. Development trees have not</div><div>&nbsp; &nbsp; &nbsp; &nbsp;necessarily received the same level of testing as standard</div><div>&nbsp; &nbsp; &nbsp; &nbsp;release distributions, so this installation method is usually</div><div>&nbsp; &nbsp; &nbsp; &nbsp;required only if you need the most recent code changes. For</div><div>&nbsp; &nbsp; &nbsp; &nbsp;information on building from one of the development trees, see</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Section 2.9.3, "Installing MySQL from a Development Source</div><div>&nbsp; &nbsp; &nbsp; &nbsp;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&nbsp;</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 &nbsp;(一般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>&nbsp;是一个开源的编译软件</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 &amp;</li><li><li>[root@Snort-test local]# mysql -uroot -p</li><li>Enter password:&nbsp;</li><li>Welcome to the MySQL monitor. &nbsp;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&gt; show databases;</li><li>+--------------------+</li><li>| Database &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</li><li>+--------------------+</li><li>| information_schema |&nbsp;</li><li>| mysql &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp;</li><li>| performance_schema |&nbsp;</li><li>| test &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp;</li><li>+--------------------+</li><li>4 rows in set (0.00 sec)</li><li><br></li><li>mysql&gt;&nbsp;</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>

论坛徽章:
0
发表于 2013-02-25 07:40 |显示全部楼层
请问怎样用RPM包安装MySQL 5.6?

http://dev.mysql.com/doc/refman/ ... stallation-rpm.html

MySQL 5.6 Reference Manual :: 2 Installing and Upgrading MySQL :: 2.5 Installing MySQL on Linux :: 2.5.1 Installing MySQL from RPM Packages on Linux
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP