Compile under CentOS installation AliSQL

 

If you install MySQL RM/etc/my.cnf unload, otherwise ignore

 

Uninstall the installed MySQL

 

Yum remove MySQL MySQL-Server MySQL-libs compat-mysql51 (51 to version)

 

rm –rf /var/lib/mysql

 

rm /etc/my.cnf

 

See if there are MySQL software

 

rpm -qa|grep mysql

 

If there is, will continue to

 

Yumy remove query software

 

First, to do before you compile and install AliSQL

 

1, tools and libraries required to compile the source code

 

yum install gcc gcc-c++ ncurses-devel perl

 

2, cmake installed, or download the required version from https://cmake.org/download/

 

 

 

3)、cd cmake-2.8.10.2

 

4)、./bootstrap ; make ; make install

 

5)、cd ~

 

3, the installation of bison from http://FTP.gnu.org/GNU/bison/download the required version

 

 

2)、sudo yum install bison-2.7

 

3)、cd ~

 

Second, set the AliSQL user and group

 

1, add AliSQL users and groups

 

groupadd mysql

 

2, AliSQL new user

 

useradd -r -g mysql mysql

 

List of required to three, AliSQL

 

1, new AliSQL to the installation directory

 

mkdir –p /usr/local/mysql

 

2, the new AliSQL database data file directory

 

mkdir -p /data/mysqldb

 

Four, download the AliSQL source code and extract

 

Download from https://github.com/alibaba/AliSQL source code

 

1), decompression

 

unzip AliSQL-master.zip

 

2)、cd AliSQL-master

 

Five, compile and install AliSQL

 

1, set the compile parameters

 

cmake\

 

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

 

-DMYSQL_UNIX_ADDR=/usr/local/mysql/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/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

 

Note:

 

Re-run the configuration, you need to remove CMakeCache.txt files

 

rm CMakeCache.txt

 

2, compile the source code

 

make

 

3, the installation of

 

make install

 

Six, modify the AliSQL directory owner and group

 

1, modify AliSQL to the installation directory

 

1)、cd /usr/local/mysql

 

2)、chown -R mysql:mysql .

 

2, modify the AliSQL database file directory

 

1)、cd /data/mysqldb

 

2)、chown -R mysql:mysql .

 

Seven, the initialization AliSQL databases

 

cd /usr/local/mysql

 

scripts/mysql_install_db –user=mysql –datadir=/data/mysqldb

 

Note:

 

Error occurred while initializing the database:

 

FATAL ERROR:please install the following Perl modules before executingscripts/mysql_install_db:

 

Data::Dumper

 

Installed: autoconf

 

Command: yumy install autoconf//the package installation is installed when Data::Dumper

 

Initialization AliSQL databases command again

 

Eight, copy 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, it is overwritten

 

Kowloon, copy AliSQL startup script and join the path path

 

cp support-files/mysql.server /etc/init.d/mysqld

 

vim /etc/profile

 

PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH

 

export PATH

 

source/etc/profile

 

Ten, start the AliSQL service and add powerboot (optional)

 

service mysqld start

 

chkconfig –level 35 mysqld on

 

Third, check whether the service starts

 

netstat -tulnp | grep 3306

 

mysql -u root -p