Mysql源码包安装

#i386体系结构的
CFLAGS="-O3 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O3 -mcpu=pentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --with-raid --enable-thread-safe-client  --enable-assembler   --with-server-suffix =" for >>>MySQL Database of ZhuLuGameDB by wqh <<<" --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench
#64位系统,x86_64
CFLAGS="-O3 -m64" CXX=gcc CXXFLAGS="-O3 -m64 -felide-constructors -fno-exceptions -fno-rtti" ./configure --with-raid --enable-thread-safe-client --enable-assembler   --with-server-suffix =" for >>>MySQL Database of Zebra by Yhc<<<" --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench

#然后根据CPU数量进行编译
make -j 1 && make install

#添加用户
groupadd mysql && useradd -g mysql mysql

#创建目录
mkdir /usr/local/mysql/data && mkdir /usr/local/mysql/run && mkdir /usr/local/mysql/log && mkdir /usr/local/mysql/var

#更改mysql目录所有者
chgrp mysql -R /usr/local/mysql && chown mysql -R /usr/local/mysql

#增加打开文件数量
ulimit -n 4096

#添加PATH
echo " PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile  && export PATH=$PATH:/usr/local/mysql/bin

#strip可执行文件
strip /usr/local/mysql/libexec/mysqld

#添加LIB PATH  && 将mysql动态库加载到高速缓存/etc/ld.so.cache中
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf && ldconfig

#将my.cnf文件cp到/etc目录下
cp support-files/my-huge.cnf  /etc/my.cnf

#修改my.cnf 
[mysqld]下增加
datadir=/db/mysql

#创建数据库存放路径
mkdir /db
chown mysql.mysql /db -R

#初始化Mysql表
su - mysql -c "mysql_install_db"

#启动服务器(skip-name-resolve参数是必须的)
su - mysql -c "mysqld_safe --skip-name-resolve --open-files-limit=4096&"



本文出自 “Mr_Z” 博客,请务必保留此出处http://zhangrong.blog.51cto.com/2196532/758496

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值