mysql.5.5.21_MYSQL5.5.21版本编译方法

CentOSx86_64安装

编译MYSQL5.5版本,需要使用cmake编译器

下面为个人笔记:

cmake安装

[root@localhost data]# wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz

[root@localhost data]# tar xvf cmake-2.8.7.tar.gz

[root@localhost data]# cd cmake-2.8.7

[root@localhost cmake-2.8.7]#./configure

[root@localhost cmake-2.8.7]#make && make install

//查看mysql5.5.21的编译参数,发发现如下错误

[root@localhost mysql]# cmake . -LH

-- MySQL 5.5.21

-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:83 (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.

解决方式

[root@localhost mysql]# yum install ncurses-devel.x86_64

[root@localhost mysql]#make clean

[root@localhost mysql]#rm -rf CMakeCache.txt

[root@localhost mysql]# cmake . -LH

--

-- MySQL 5.5.21

-- Configuring done

-- Generating done

-- Build files have been written to: /data/mysql

-- Cache values

// Choose the type of build, options are: None(CMAKE_CXX_FLAGS or

CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel

CMAKE_BUILD_TYPE:STRING=RelWithDebInfo

// install prefix

CMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql

// Set to true if this is a community build

COMMUNITY_BUILD:BOOL=ON

// Enable profiling

ENABLED_PROFILING:BOOL=ON

// Enable debug sync (debug builds only)

ENABLE_DEBUG_SYNC:BOOL=ON

// Enable gcov (debug, Linux builds only)

ENABLE_GCOV:BOOL=OFF

// Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4

INSTALL_LAYOUT:STRING=STANDALONE

// default MySQL data directory

MYSQL_DATADIR:PATH=/usr/local/mysql/data

// MySQL maintainer-specific development environment

MYSQL_MAINTAINER_MODE:BOOL=OFF

// Link ARCHIVE statically to the server

WITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF

// Link BLACKHOLE statically to the server

WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF

// Use dbug/safemutex

WITH_DEBUG:BOOL=OFF

// Compile MySQL with embedded server

WITH_EMBEDDED_SERVER:BOOL=OFF

// Options are: none, complex, all 字符串

WITH_EXTRA_CHARSETS:STRING=all

// Link FEDERATED statically to the server

WITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF

// Link INNOBASE statically to the server 静态编译innodb

WITH_INNOBASE_STORAGE_ENGINE:BOOL=ON

// Use bundled libedit

WITH_LIBEDIT:BOOL=ON

// Compile with tcp wrappers support

WITH_LIBWRAP:BOOL=OFF

// Link PARTITION statically to the server 静态编译分区

WITH_PARTITION_STORAGE_ENGINE:BOOL=ON

// Link PERFSCHEMA statically to the server

WITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON

// Generate PIC objects

WITH_PIC:BOOL=OFF

// Use bundled readline

WITH_READLINE:BOOL=OFF

// Options are : no, bundled, yes (prefer os library if present otherwise use bundled), system (use os library)

WITH_SSL:STRING=no

// Compile MySQL with unit tests

WITH_UNIT_TESTS:BOOL=ON

// Valgrind instrumentation

WITH_VALGRIND:BOOL=OFF

// Use bundled zlib

WITH_ZLIB:STRING=bundled

shell> cmake -L

Gives a brief overview of important configuration parameters (dump to stdout)

shell> cmake -LH

Does the same but also provides a short help text for each parameter.

shell> cmake -LAH

Dumps all config parameters (including advanced) to the stdout.

MYSQL参数;

http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

MYSQL编译参数

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/dbdata \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_EXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_SSL=yes

# Preconfiguration setup

shell> groupadd mysql

shell> useradd -r -g mysql mysql

# Beginning of source-build specific instructions

shell> tar zxvf mysql-VERSION.tar.gz

shell> cd mysql-VERSION

shell> cmake .

shell> make

shell> make install

# End of source-build specific instructions

# Postinstallation setup

shell> cd /usr/local/mysql

shell> chown -R mysql.mysql /usr/local/mysql

[root@localhost mysql]# scripts/mysql_install_db --user=mysql

Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'

./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

./bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> bin/mysqld_safe --user=mysql &

# Next command is optional

//查看MYSQL是否正常启动

[root@localhost mysql]# ps -ef|grep mysql

root     12381  2182  0 17:21 pts/0    00:00:00 /bin/sh bin/mysqld_safe --user=mysql

mysql    12637 12381  0 17:21 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/dbdata --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/dbdata/localhost.localdomain.err --pid-file=/data/dbdata/localhost.localdomain.pid --socket=/usr/local/mysql/tmp/mysql.sock --port=3306

root     12706  2236  0 18:45 pts/1    00:00:00 grep mysql

shell> cp support-files/mysql.server /etc/init.d/mysql.server

编译错误:

CMake Error at cmake/bison.cmake:78 (MESSAGE):

Bison (GNU parser generator) is required to build MySQL.Please install

bison.

Call Stack (most recent call first):

sql/CMakeLists.txt:189 (RUN_BISON)

[root@oracle141 Percona-Server-5.5.18-rel23.0]# yum install bison.x86_64  bison-devel.x86_64

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值