安装相关包:
cd /home/oldboy/tools/rz -ytar xf cmake-2.8.8.tar.gzcd cmaake-2.8.8./configuregmakegmake installcd ..依赖包:
yum install ncurses-devel -y
开始安装mysql
创建用户和组
groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql解压编译MYSQL
tar xf mysql-5.5.32.tar.gz
cd mysql-5.5.32cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \-DMYSQL_DATADIR=/application-5.5.32/data \-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock \-DEXTRA_CHARSETS=gbk,bgk2312,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可不编译的字符集:
#-DDEFAULT_CHARSET=utf8 \#-DDEFAULT_COLLATTON=utf8_general_ci \
make
make installln -s /application/mysql-5.5.32/ /application/mysql
cd ..cp mysql-5.5.32/support-files-files/my-small.cnf /etc/my.cnf
配置环境变量:
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profiletail -1 /etc/profilesource /etc/profile故障问题:http://oldboy.51cto.com/2561410/1122867
建立mysql数据文件
mkdir -p /application/mysql/dada
授权mysql用户访问mysql的安装目录
chown -R mysql.mysql /application/mysql/data/
调整/tmp权限,否则初始化会错误
chmod -R 1777 /tmp/
安装mysql数据库文件,注意命令路径
cd /application/mysql/scripts/./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
cd /home/oldboy/tools/mysql-5.5.32/
拷贝mysql启动脚本到/etc/init.d下 cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld启动mysql
/etc/init.d/mysqld start