标签:mysql
#安装依赖包
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
#指定字符集
#-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
原文地址:http://it1693.blog.51cto.com/2342744/1692982