Chinaunix首页 | 论坛 | 博客
  • 博客访问: 743963
  • 博文数量: 95
  • 博客积分: 1754
  • 博客等级: 上尉
  • 技术积分: 1607
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-12 10:06
文章分类

全部博文(95)

文章存档

2015年(3)

2013年(15)

2012年(77)

分类: Mysql/postgreSQL

2012-03-22 18:52:13

CentOSx86_64安装
编译MYSQL5.5版本,需要使用cmake编译器
下面为个人笔记:
cmake安装
[root@localhost data]# wget
[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
阅读(13825) | 评论(7) | 转发(0) |
0

上一篇:mongodb安装

下一篇:mysqldump用法尚方宝剑

给主人留下些什么吧!~~

alang852012-05-30 16:36:02

weilua: 安装到一半直接冒出一个排错的步骤,觉得应该在最后的时候把出现错误的地方一并列出吧,楼主。.....
欢迎提问。
因为这个错误,在我编译是碰到,就写上。

weilua2012-05-30 16:29:30

安装到一半直接冒出一个排错的步骤,觉得应该在最后的时候把出现错误的地方一并列出吧,楼主。

alang852012-03-26 11:46:50

十七岁的回忆: [root@localhost mysql]# cmake . -LH
-- MySQL 5.5.21
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/rea.....
你没有安装ncurses-devel,根据你系统的架构选择。

alang852012-03-26 11:46:22

你没有安装ncurses-devel

十七岁的回忆2012-03-25 22:41:03

[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.这么多错误么?