首页 移动开发 在线交易 IT笔记 网络技术 操作系统 企业架构 数据库 考试认证 IT培训 开源软件 数据存储 行业资讯
大家都在看:java   开发   C#   oracle   mysql   android   web开发   学习   sqlserver   linux   asp   php   ajax   javascript   css   html
CentOS源码编译安装MySQL 5.5.15
2014-11-17 09:55:09 来源: 作者:admin 栏目:MySQL 责任编辑:
[导读] 源:https://www.centos.bz/2011/09/linux-compile-install-mysql-5-5-15-from-source/评:原文章 链接 安装 会有问题------------源:http://zhidao.baidu.com/link?url=C-hPJEQ03Jj-vhY1fbZTnCWtfZKMLZravivU2_CT4wBtMLMw3rJHN7r1ZLv_yMpFQJRRt0hY6TbMi0pvkim6..
源:https://www.centos.bz/2011/09/linux-compile-install-mysql-5-5-15-from-source/
评:原文章  链接  安装 会有问题


------------
源:http://zhidao.baidu.com/link?url=C-hPJEQ03Jj-vhY1fbZTnCWtfZKMLZravivU2_CT4wBtMLMw3rJHN7r1ZLv_yMpFQJRRt0hY6TbMi0pvkim6Xa

问题  :Starting MySQL..The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid

问题描述: [root@bogon mysql-5.1.41]# /etc/rc.d/init.d/mysqld startStarting MySQL.Manager of pid-file quit without updating file.[失败] --------------------------- 解决办法:配置的时候有一个步骤是 cp support-files/my-medium.cnf /etc/my.cnf ; 就编辑my.cnf,在[mysqld]下面加上:datadir = /usr/local/mysql/data 例如# The MySQL server[mysqld]port            = 3306socket          = /tmp/mysql.sockskip-lockingkey_buffer_size = 16Mmax_allowed_packet = 1Mtable_open_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_s ...

2.首先到/usr/local/mysql/data先 chown -R mysql:mysql * 然后杀掉mysql进程,在启动musql就行了

打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试3.

4.确实一般都是my.cnf配置文件的问题
/etc/my.cnf来自以下文件:

如果你的内存≤64M,则复制/usr/local/share/mysql/my-small.cnf为/etc/my.cnf
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.

如果内存是128M,则复制/usr/local/share/mysql/my-medium.cnf为/etc/my.cnf
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)

如果内存是512M,则复制/usr/local/share/mysql/my-large.cnf为/etc/my.cnf
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.

如果内存是1-2G,则复制/usr/local/share/mysql/my-huge.cnf为/etc/my.cnf
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.




--------------------
安装编译工具

    yum install gcc gcc-c++
    yum install ncurses-devel

下载源码

    mkdir -p /tmp
    cd /tmp
    wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz
    wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
    wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz

安装cmake和bison

    cd /tmp
    tar zxvf cmake-2.8.4.tar.gz
    cd cmake-2.8.4
    ./bootstrap
    make
    make install

    cd /tmp
    tar zxvf bison-2.5.tar.gz
    cd bison-2.5
    ./configure
    make
    make install

编译安装MySQL

    /usr/sbin/groupadd mysql
    /usr/sbin/useradd -g mysql mysql
    cd /tmp
    tar xvf mysql-5.5.15.tar.gz
    cd mysql-5.5.15/
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
    -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
    -DDEFAULT_CHARSET=utf8 \
    -DDEFAULT_COLLATION=utf8_general_ci \
    -DWITH_EXTRA_CHARSETS=all \
    -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
    
    make
    make install

详细编译参数参考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
一些相关设置

    chmod +w /usr/local/mysql
    chown -R mysql:mysql /usr/local/mysql
    ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
    mkdir -p /var/mysql/
    mkdir -p /var/mysql/data/
    mkdir -p /var/mysql/log/
    chown -R mysql:mysql /var/mysql/
    cd support-files/
    # 这句没用 会报开头错误cp my-large.cnf /var/mysql/my.cnf
    cp my-large.cnf /etc/my.cnf
    cp mysql.server /etc/rc.d/init.d/mysqld
    
    /usr/local/mysql/scripts/mysql_install_db \
    --defaults-file=/var/mysql/my.cnf \
    --basedir=/usr/local/mysql \
    --datadir=/var/mysql/data \
    --user=mysql
    
   
    chmod +x /etc/init.d/mysqld

    vi /etc/init.d/mysqld(编辑此文件,查找并修改以下变量内容:)
    basedir=/usr/local/mysql
    datadir=/var/mysql/data

加入启动项:

    chkconfig --add mysqld
    chkconfig --level 345 mysqld on

启动服务:

    service mysqld start

设置密码:

    /usr/local/mysql/bin/mysqladmin password [new-password]
标签:
本站地址:/
版权所有:转载请注明出处!
分享到:
上一篇ORA-12519: TNS:no appropriate s.. 下一篇通达OA自动发起工作流代码
您可能还喜欢
暂无...
今日最新资讯 最新推荐信息
考试认证 更多
开发技术 更多
移动开发 更多

关于 | 合作伙伴 | 联系我们 | 友情链接 | 版权声明 | 网站制作 | 网站地图 | 加入收藏 | 设为首页

Copyright@2012-2016 京ICP备12027873号