码迷,mamicode.com
首页 > 数据库 > 详细

编译安装mysql

时间:2015-09-09 11:37:01      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:mysql

#安装cmake

#安装依赖包

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

 

#安装脚本:

tar xf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake

gmake install

cd ../

#创建mysql 用户及组

groupadd mysql

useradd mysql -s /sbin/nologin -M -g mysql

#解压编译mysql

#指定字符集

#-DDEFAULT_CHARSET=utf8 \

#-DDEFAULT_COLLATION=utf8_general_ci \

 

tar zxf mysql-5.5.32.tar.gz

cd mysql-5.5.32

cmake .-DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \

-DMYSQL_DATADIR=/application/mysql-5.5.32/data \

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \

-DENABLED_LOCAL_INFILE=ON \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \

-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FAST_MUTEXES=1 \

-DWITH_ZLIB=bundled \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DWITH_DEBUG=0

#-- Build files have been written to:/home/oldboy/tools/mysql-5.5.32

#提示,编译时可配置的选项很多,具体可参考结尾附录或官方文档:

make

#[100%] Built target my_safe_process

make install

ln -s /application/mysql-5.5.32/ /application/mysql

#选择配置文件

/bin/cp support-files/my-small.cnf /etc/my.cnf

#多实例配置环境变量

#方法一

echo ‘export PATH=/application/mysql/bin:$PATH‘>> /etc/profile

echo `tail -1 /etc/profile`

source /etc/profile

echo $PATH

#方法二

 #把/usr/local/mysql/bin 下面的命令拷贝到全局系统命令路径/usr/local/sbin,或者做link连接

#路径不对,在编译安装前有yum安装mysql,解决方法

#http://oldboy.blog.51cto.com/2361410/1122867

#初始化数据库

/bin/sh/application/mysql/scripts/mysql_install_db  --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql

#复制mysql启动脚本到init.d中,并授权

/bin/cp /root/tools/mysql-5.5.32/support-files/mysql.server/etc/init.d/mysqld

chmod +x /etc/init.d/mysqld 

echo "ll /etc/init.d/mysql"

echo `ll /etc/init.d/mysqld`

 

find /data/ -type f -name "mysql" |xargs chmod +x

#启动数据库

/etc/init.d/mysqld start

netstat -lntup |grep 3306

lsof -i :3306

#启动数据库

/etc/init.d/mysqld start

netstat -lntup |grep 3306

lsof -i :3306


本文出自 “it1693” 博客,请务必保留此出处http://it1693.blog.51cto.com/2342744/1692982

编译安装mysql

标签:mysql

原文地址:http://it1693.blog.51cto.com/2342744/1692982

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!