Compile and install AliSQL in CentOS
If MySQL is installed, rm/etc/my. cnf is uninstalled; otherwise, ignore
Uninstall installed MySQL
Yum remove mysql-server mysql-libs compat-mysql51 (version 51)
Rm-rf/var/lib/mysql
Rm/etc/my. cnf
Check whether mysql software exists
Rpm-qa | grep mysql
If yes, continue
The software name queried by yum-y remove
I. Preparations before compiling and installing AliSQL
1. Tools and libraries required for compiling source code
Yuminstallgccgcc-c ++ ncurses-develperl
2. Install cmake or download the required version from https://cmake.org/download/
1) wgethttp: // www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
2), tar-zxvf cmake-2.8.10.2.tar.gz
3) cdcmake-2.8.10.2
4)../bootstrap; make; makeinstall
5), cd ~
3. Install bison and download the required version from http://ftp.gnu.org/gnu/bison/
1), tar-zxvf bison-2.7.tar.gz
2). sudo yum install bison-2.7
3) cd ~
2. Set AliSQL users and groups
1. Add AliSQL users and groups
Groupaddmysql
2. Added AliSQL users.
Useradd-r-gmysqlmysql
Iii. directories required by AliSQL
1. Create an AliSQL installation directory
Mkdir-p/usr/local/mysql
2. Create a data file directory for the AliSQL Database
Mkdir-p/data/mysqldb
4. Download AliSQL source code and decompress it
Download the source code from https://github.com/alibaba/alisql
1) decompress
Unzip AliSQL-master.zip
2). cd AliSQL-master
5. Compile and install AliSQL
1. Set compilation Parameters
Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DMYSQL_DATADIR =/data/mysqldb \
-DMYSQL_TCP_PORT = 3306 \
-DENABLE_DOWNLOADS = 1
Or:
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-rows = 1-rows = 1-rows = 1-DMYSQL_DATADIR =/data/mysqldb-rows = 3306-DENABLE_DOWNLOADS = 1
Note:
Refresh the configuration and delete the cmakecache.txt file.
RmCMakeCache.txt
2. Compile the source code
Make
3. Installation
Make install
6. Modify the AliSQL directory owner and group
1. Modify the AliSQL installation directory
1), cd/usr/local/mysql
2) chown-Rmysql: mysql.
2. Modify the AliSQL database file directory
1), cd/data/mysqldb
2) chown-Rmysql: mysql.
7. initialize the AliSQL Database
Cd/usr/local/mysql
Scripts/mysql_install_db-user = mysql-datadir =/data/mysqldb
Note:
An error occurred while initializing the database:
Fatal error: please install the following Perl modules before executingscripts/mysql_install_db:
Data: Dumper
Installation: autoconf Library
Command: yum-y install autoconf // this package will install Data: Dumper
Execute the AliSQL database initialization command again
8. Copy the AliSQL service startup configuration file
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my. cnf
Note: If the/etc/my. cnf file exists, Overwrite
IX. Copy the AliSQL Service Startup Script and add it to the path
Cp support-files/mysql. server/etc/init. d/mysqld
Vim/etc/profile
PATH =/usr/local/mysql/bin:/usr/local/mysql/lib: $ PATH
ExportPATH
Source/etc/profile
10. Start AliSQL and add it to auto-start upon startup (optional)
Servicemysqldstart
Chkconfig-level35mysqldon
11. Check whether the service is started
Netstat-tulnp | grep3306
Mysql-uroot-p
Original article link: Click