时间:2021-07-01 10:21:17 帮助过:26人阅读
mysql 最新的版本都需要cmake编译安装,估计以后的版本也会采用这种方式,所以特地记录一下安装步骤及过程,以供参考。注意:此安
mysql 最新的版本都需要cmake编译安装,估计以后的版本也会采用这种方式,,所以特地记录一下安装步骤及过程,以供参考。
注意:此安装是默认RedHat下已经安装了最新工具包,比如GNU make, GCC, Perl, libncurses5-dev,如果在编译安装过程中发现有缺失的工具包,先yum install 单独下载安装再继续即可。
相关教程:
RedHat Linux 2.6.18下安装MySQL 5.1.7及Navicat 8 见redhat9下安装mysql-4.0.26记 见
RedHat下MySQL 5.6 安装、维护 见
一. linux用 wget 下载需要的软件,保存到目录 /usr/local/src 下
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.20.tar.gz
wget
wget
二. 安装 cmake
cd /usr/local/src
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7.tar.gz
./bootstrap
gmake
gmake install
cd ../
tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make
make install
cd ../
三. 编译安装 MySQL 5.5.20
groupadd –g 1000 mysql
useradd –u 1000 –g mysql mysql
tar xvf mysql-5.5.20.tar.gz
cd mysql-5.5.20/
/usr/local/bin/cmake .
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_USER=mysql
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Pleaseinstall appropriate package,
removeCMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:117 (FIND_CURSES)
cmake/readline.cmake:213(MYSQL_USE_BUNDLED_READLINE)
CMakeLists.txt:250 (MYSQL_CHECK_READLINE)
yum install ncurses-devel
rm CMakeCache.txt
-- 这里重新开始做cmake操作即可
make
make install
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
ln -s /usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18
mkdir -p /usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql/data
ln -s /usr/local/mysql/data /home/mysql/data
mkdir -p /var/mysql/log/
chown -R mysql:mysql /var/mysql/
cd support-files/
cp my-large.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysqld