操作系统:CentOS6.0
数据库:mysql community server 5.5.16
Gcc和c++、ncurses都必须安装才得行,否则会出错
mysql community 5.5.16编译安装
tar zxvf mysql-5.5.16.tar.gz
cd mysql-5.5.16
cmake .
make
make install
在安装cmake .的过程中,有可能会出现错误:
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,
Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:127 (FIND_CURSES)
cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:257 (MYSQL_CHECK_READLINE)
需要安装libncurses5-dev。
如果没有安装上面提到的gcc、g++,有可能会提示下面的错误:
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
– Performing Test HAVE_PEERCRED – Failed
Warning: Bison executable not found in PATH
– Configuring incomplete, errors occurred!
如果在make中提示错误,也是缺少软件包造成的。我碰到的就是上面两种错误。
Mysql数据库初始化
mysql安装过程中默认会在/etc/mysql目录copy一个my.cnf配置文件。根据自己的需要修改这个文件。
………………..
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3308
basedir = /usr/local/mysql
datadir = /app/mysql
……………………..
安装mysql权限表和默认系统schema,在前面的cmake过程中如果没有指定mysql安装目录,默认情况下会安装在/usrl/local下面:
root@debian:/home/mysql/mysql-5.5.16# cd /usr/local/mysql/
设置mysql默认用户组
chown -R mysql:mysql .
初始化mysql数据库
root@debian:/usr/local/mysql# cd /usr/local/mysql
root@debian:/usr/local/mysql# scripts/mysql_install_db –defaults_file=/etc/mysql/my.cnf –user=mysql &
Mysql测试: