1.安装前准备工作
[root@backup_server ~]# uname -r
2.6.32-431.el6.x86_64
[root@backup_server ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@backup_server ~]# uname -r
2.6.32-431.el6.x86_64
[root@backup_server ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
tar zxf mysql-5.5.32.tar.gz
tar cmake-2.8.8.tar.gz
tar zxf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install
tar cmake-2.8.8.tar.gz
tar zxf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install
yum install ncurses-devel -y
useradd mysql -M -s /sbin/nologin
useradd mysql -M -s /sbin/nologin
2.cmake安装mysql
cd mysql-5.5.32
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 \
-DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-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
make && make install
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 \
-DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-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
make && make install
3.安装后配置
ln -s /usr/local/mysql-5.5.32 /usr/local/mysql
选择配置文件
\cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
配置环境变量
echo 'export PATH=/usr/local/mysql/bin/:$PATH' >> /etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
echo 'export PATH=/usr/local/mysql/bin/:$PATH' >> /etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
初始化数据库
chown -R mysql.mysql /usr/local/mysql/data/
chmod -R 1777 /tmp/
cd /usr/local/mysql/scripts/
./mysql_install_db --basedir=/usr/local/mysql-5.5.32/ --datadir=/usr/local/mysql-5.5.32/data/ --user=mysql
cp ../support-files/mysql.server /etc/init.d/mysqld
chmod u+x /etc/init.d/mysqld
service mysqld start
chown -R mysql.mysql /usr/local/mysql/data/
chmod -R 1777 /tmp/
cd /usr/local/mysql/scripts/
./mysql_install_db --basedir=/usr/local/mysql-5.5.32/ --datadir=/usr/local/mysql-5.5.32/data/ --user=mysql
cp ../support-files/mysql.server /etc/init.d/mysqld
chmod u+x /etc/init.d/mysqld
service mysqld start