Linux下源码编译安装MySQL 5.5.8

准备工作:

新建用户和用户组

groupadd mysql
useradd -g mysql mysql 1:下载: bison-2.4.2.tar.bz2
cmake-2.8.3.tar.gz
make-3.82.tar.gz
bzr-2.3b5.tar.gz
mysql-5.5.8.tar.gz 2:解压安装前3个包 tar zxvf cmake-2.8.3.tar.gz
cd cmake-2.8.3
./configure
make
make install
tar zxvf make-3.82.tar.gz
cd make-3.8.2
./configure
make
make install tar jxvf bison-2.4.2.tar.bz2
cd bison-2.4.2
./configure
make
make install 3:解压mysql-5.5.8.tar.gz tar zxvf mysql-5.5.8.tar.gz
cd mysql-5.5.8 cmake . \
-DCMAKE_INSTALL_PREFIX=/mysql/mysqldir \
-DMYSQL_DATADIR=/mysql/mysqldir/data \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR==/mysql/mysqldir/data/mysql.sock \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 报错(如无报错直接make & make install 即可): CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on RedHat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:256 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred! 缺少包:ncurses-devel 解决: 到安装光盘或者网上DOWN相应的包 安装: rpm -ivh ncurses-devel*.rpm rm -f CMakeCache.txt cmake . \
-DCMAKE_INSTALL_PREFIX=/mysql/mysqldir \
-DMYSQL_DATADIR=/mysql/mysqldir/data \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR==/mysql/mysqldir/data/mysql.sock \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 make
make install 完成后进入MYSQL安装目录 cd /mysql/mysqldir
cp support-files/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf 将数据目录和套接字文件修改为实际值. 修改权限 chown mysql:mysql /etc/my.cnf
chown -R mysql:mysql /mysql/mysqldir 切换用户进入安装目录 su - mysql
cd /mysql/mysqldir
cp scripts/mysql_install_db .
./mysql_install_db 启动MYSQL bin/mysqld_safe & OK
上一篇:Java集合类学习笔记(各种Map实现类的性能分析)


下一篇:IP网络5种基本寻址方式 (单播、多播、广播、任播、地域多播)