Preface
AliSQL is a branch based on the official version of MySQL, maintained by the Alibaba Cloud database team, and is currently also used in Alibaba Group's business and Alibaba Cloud database services. This version has done a lot of performance and function optimization and improvement on the basis of the community version. It is especially suitable for industry environments such as e-commerce, cloud computing, and finance.
Ready to work
1. Tools and libraries needed to compile source code
yum install gcc gcc-c++ ncurses-devel perl
2. Install cmake
1) Create a directory
cd /opt
mkdir alisql
2) Download the source code
cd /alisql
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
3) Unzip the source code
tar zxvf cmake-2.8.10.2.tar.gz
4) Compile
cd cmake-2.8.10.2
./bootstrap
make
make install
2. Install bison
1) Download the source code
cd /opt/alisql
wget http://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz
2) Unzip the source code
tar zxvf bison-2.7.tar.gz
3) Compile
cd bison-2.7
./configure
make -j 8
make install
Formal steps
1. Set up AliSQL groups and users
groupadd mysql
useradd -r -g mysql mysql
2. Create the required directory for AliSQL
mkdir -p /data/mysqldb
mkdir –p /opt/install
mkdir –p /opt/install/mysql
3. Download AliSQL source code
https://github.com/alibaba/AliSQL/tags
Method 1 Link: https://pan.baidu.com/s/1hCFwkdRClQ5I6qab_cbG6Q Password: 312d
Way two
cd /opt/alisql
wget https://github.com/alibaba/AliSQL/archive/AliSQL-5.6.32-8.tar.gz
4. Unzip the source code
tar zxvf AliSQL-5.6.32-8.tar.gz
5. Set compilation parameters
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/mysql -DMYSQL_UNIX_ADDR=/opt/install/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=13308 -DENABLE_DOWNLOADS=1
Note: If you need to re-run the configuration, you need to delete the CMakeCache.txt file (rm CMakeCache.txt)
6. Compile
make
make install
7. Modify the directory owner and group
cd /opt/install/mysql
chown -R mysql:mysql .
cd /data/mysqldb
chown -R mysql:mysql .
8. Initialize the AliSQL database
cd /opt/install/mysql/
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
9. Copy AliSQL startup configuration file
cp /opt/install/mysql/support-files/my-default.cnf /etc/my.cnf
Note: If the /etc/my.cnf file exists, it will be overwritten
vi /etc/my.cnf
Press i in English input state to enter insert mode, add the following configuration
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
Press esc to enter : wq save and exit
10. Copy the AliSQL startup script and add the path path
cp support-files/mysql.server /etc/init.d/mysqld
11. Modify environment variables
vi /etc/profile
Press i in English input state to enter insert mode, add the following configuration
export PATH=/opt/install/mysql/bin:/opt/install/mysql/lib:$PATH
Press esc to enter : wq to save and exit, compile /etc/profile to make the configuration effective
source /etc/profile
11. Start the AliSQL service
service mysqld start
12. Add boot auto-start
chkconfig --level 35 mysqld on
13. Set password
mysql -u root -p
use mysql;
select host,user, password from user;
update user set password=password('xxxx'), host= '%' where user ='root' and host='127.0.0.1';
flush privileges;
Note: When prompted to enter the password, you can skip directly by pressing Enter
14. Connection
expand
Support emoji expressions
1. Modify the mysql configuration file
vi /etc/my.cnf
In English input state, press i to enter insert mode. Add and modify the following configuration
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
Press esc to enter : wq save and exit
2. Restart the MySQL service
service mysqld restart