天天看点

mysql编译方式安装1、cmake包安装2、mysql安装

1、cmake包安装

上传cmake-2.8.8.tar.gz到opt下,解压tar xf cmake-2.8.8.tar.gz。

执行./configure,报错如下:

Error when bootstrapping CMake:

Cannot find appropriate C++ compiler on this system.

这是由于最小化安装centos后,没有安装cc编译器,因此yum install gcc、yum install gcc-c++

再次执行./configure成功。执行gmake,gmake install。

2、mysql安装

编译mysql

cmake -DCMAKE_INSTALL_PREFIX=/mysql \

-DMYSQL_DATADIR=/mysql/data \

-DSYSCONFDIR=/etc \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DMYSQL_UNIX_ADDR=/mysql/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DEXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

执行报错,如下:

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.

Call Stack (most recent call first):

cmake/readline.cmake:127 (FIND_CURSES)

cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:269 (MYSQL_CHECK_READLINE)

原因是操作未安装ncurses-devel,安装yum install ncurses-devel。再次执行编译,成功。

执行make && make install 安装。

复制cp /mysql/support-files/my-small.cnf /etc/ ,cp /mysql/support-files/mysql.server /etc/init.d/mysqld

启动/etc/init.d/mysqld start ,报错Starting MySQL. ERROR! The server quit without updating PID file (/mysql/ares.pid).

查看日志信息more /mysql/data/ares.err ,报错为190331 10:44:35 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!

添加用户mysql后,更改mysql目录权限,/etc/init.d/mysqld start 启动成功。

继续阅读