Mysql 5.5.16实践完全手工编译成功

来源:未知 责任编辑:智问网络 发表时间:2013-11-12 17:21 点击:

 

一、虚拟环境准备

 

虚拟机:VMware Workstation

System:CentOS6.0(64Bit)基本安装

 

二、相关组件下载地址

cmake:http://www.cmake.org/

bison:http://www.gnu.org/s/bison/

mysql:http://www.mysql.com/

M4:http://www.gnu.org/s/m4/

 

三、组件下载、安装

[root@CentOS ~]# cd /usr/src/

[root@CentOS src]# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz

[root@CentOS src]# wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz

[root@CentOS src]# wget http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.5/mysql-5.5.16.tar.gz

[root@CentOS src]# wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz

 

 ⑴cmake 、bison安装

[root@CentOS src]# tar -zxvf cmake-2.8.5.tar.gz

[root@CentOS src]# cd cmake-2.8.5

[root@CentOS cmake-2.8.5]# ./bootstrap

[root@CentOS cmake-2.8.5]# make

[root@CentOS cmake-2.8.5]# make install

[root@CentOS cmake-2.8.5]# cmake --version

cmake version 2.8.5

[root@CentOS src]# tar -zxvf bison-2.5.tar.gz

[root@CentOS src]# cd bison-2.5

[root@CentOS bison-2.5]#./configure

[root@CentOS bison-2.5]#make

[root@CentOS bison-2.5]#make install

[root@CentOS bison-2.5]# bison --version

bison (GNU Bison) 2.4.1

Written by Robert Corbett and Richard Stallman.

Copyright (C) 2008 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 ⑵mysql 安装

[root@CentOS src]# tar -zxvf mysql-5.5.16.tar.gz

[root@CentOS src]# cd mysql-5.5.16

[root@CentOS mysql-5.5.16]# groupadd mysql www.2cto.com

[root@CentOS mysql-5.5.16]# useradd -g mysql mysql

[root@CentOS mysql-5.5.16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

> -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

> -DDEFAULT_CHARSET=utf8 \

> -DDEFAULT_COLLATION=utf8_general_ci \

> -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 \

> -DWITH_MYISAM_STORAGE_ENGINE=1 \

> -DWITH_INNOBASE_STORAGE_ENGINE=1 \

> -DWITH_MEMORY_STORAGE_ENGINE=1 \

> -DWITH_READLINE=1 \

> -DENABLED_LOCAL_INFILE=1 \

> -DMYSQL_DATADIR=/var/mysql/data \

> -DMYSQL_USER=mysql

相同功能

[root@CentOS mysql-5.5.16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/var/mysql/data -DMYSQL_USER=mysql

[root@CentOS mysql-5.5.16]# make

[root@CentOS mysql-5.5.16]# make install

[root@CentOS mysql-5.5.16]# chmod +w /usr/local/mysql

[root@CentOS mysql-5.5.16]# chown -R mysql:mysql /usr/local/mysql

[root@CentOS mysql-5.5.16]# cd /usr/local/mysql/lib

[root@CentOS lib]# ls

libmysqlclient.a  libmysqlclient_r.so.18  libmysqlclient.so.18      plugin

libmysqlclient_r.a libmysqlclient_r.so.18.0.0  libmysqlclient.so.18.0.0

libmysqlclient_r.so libmysqlclient.so   libmysqlservices.a

[root@CentOS lib]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18   32Bit

[root@CentOS lib]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18  64Bit

[root@CentOS src]# cd /usr/src/mysql-5.5.16

[root@CentOS mysql-5.5.16]# mkdir -p /var/mysql/

[root@CentOS mysql-5.5.16]# mkdir -p /var/mysql/data/

[root@CentOS mysql-5.5.16]# mkdir -p /var/mysql/log/

[root@CentOS mysql-5.5.16]# chown -R mysql:mysql /var/mysql/

[root@CentOS mysql-5.5.16]# cp /usr/src/mysql-5.5.16/support-files/my-large.cnf /var/mysql/my.cnf

[root@CentOS mysql-5.5.16]# cp /usr/src/mysql-5.5.16/support-files/mysql.server /etc/init.d/mysqld

[root@CentOS mysql-5.5.16]# /usr/local/mysql/scripts/mysql_install_db \

> --defaults-file=/var/mysql/my.cnf \

> --basedir=/usr/local/mysql \

> --datadir=/var/mysql/data \

> --user=mysql

相同功能

[root@CentOS mysql-5.5.16]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/var/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/var/mysql/data --user=mysql

[root@CentOS mysql-5.5.16]# chmod +x /etc/init.d/mysqld

[root@CentOS mysql-5.5.16]# vim /etc/init.d/mysqld  (修改)

basedir=/usr/local/mysql

datadir=/var/mysql/data

[root@CentOS mysql-5.5.16]# chkconfig --add mysqld

[root@CentOS mysql-5.5.16]# chkconfig --level 345 mysqld on

[root@CentOS mysql-5.5.16]# service mysqld start

Starting MySQL.. SUCCESS!

[root@CentOS tmp]# mysqladmin -u root -p password 123.com

Enter password:

 

 

四、FQA常见问题

 ①[root@CentOS mysql-5.5.16]# service mysqld start

    Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/CentOS.LNMP.pid).

解决方案:

 [root@CentOS mysql-5.5.16]# mv /etc/my.cnf my.cnf.bakcup

 

 ②[root@CentOS mysql-5.5.16]# mysqladmin -u root -p password 123.com

 Enter password:

 mysqladmin: connect to server at 'localhost' failed

 error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

 Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

解决方案:

 [root@CentOS mysql-5.5.16]# vim /var/mysql/my.cnf

 socket =/tmpl/mysql.sock 修改socket = /var/lib/mysql/mysql.sock

 [root@CentOS tmp]# ln -s /tmp/mysql.sock /var/lib/mysql/

 [root@CentOS tmp]# mysqladmin -u root -p password 123.com

 Enter password:

 

 

联系:QQ:64324613

 

 

 

本文出自 “13975309974” 博客

    发表评论
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    用户名: 验证码:点击我更换图片
    最新评论 更多>>

    推荐热点

    • mysql-mmm
    • mysqldump命令——MySQL数据库备份还原
    • Oracle数据导入MySQL的快捷工具:MySQL Migration Toolkit
    • 简简单单储存过程——循环一个select结果集
    • MySQL数据库十大优化技巧
    • Mysql安装笔记
    • Mysql主主复制架构配置
    • Mysql的Procedure 参数为NULL问题分析
    • MySQL Stmt预处理提高效率问题的小研究
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1