由于公司設(shè)備對數(shù)據(jù)需要大量的讀取和查詢,開始使用的mysql8,但是未優(yōu)化的mysql插入和查詢及其緩慢,因此我與同事分開研究,優(yōu)化方案。我負(fù)責(zé)尋找可替代高效的數(shù)據(jù)庫,然后問同學(xué),發(fā)現(xiàn)alisql性能不錯(cuò),打算研究下,安裝后發(fā)現(xiàn)相同未配置情況下,alisql可以快mysql起碼十倍。
注:由于我們程序內(nèi)存在長索引,但是由于5.6.32基于的mysql版本過老,無法加長索引,故放棄,但是用來一般畢業(yè)設(shè)計(jì)或者沒有場索引需求的產(chǎn)品,我認(rèn)為這是個(gè)絕佳的選擇。
如果程序內(nèi)有一些必須新版mysql才能實(shí)現(xiàn)的功能,建議直接放棄此版本數(shù)據(jù)庫。
安裝步驟
1.系統(tǒng)準(zhǔn)備
安裝centos7時(shí),選擇帶有桌面服務(wù)器,軟件選擇中必選“開發(fā)工具”(如果不選開發(fā)軟件,gcc之類的都是默認(rèn)不裝的,安裝起來需要各種依賴很麻煩)
2、下載準(zhǔn)備需要使用的安裝包
ncurses-5.9.tar.gz
cmake-2.8.10.2.tar.gz
bison-2.7.tar.gz
AliSQL-AliSQL-5.6.32-8.tar.gz
my.cnf(此文件為數(shù)據(jù)庫配置)
以上為所需要的安裝包,自行去網(wǎng)上下載一下。
或者使用百度網(wǎng)盤:鏈接: https://pan.baidu.com/s/1VMMH_ZoiaAGRK_pcZYjlAA 提取碼: awpi
將所有安裝包和文件拖入到/opt/alisql/下,這個(gè)文件夾需要自己創(chuàng)建。
my.cnf文件內(nèi)容:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
disable_log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 10M
sort_buffer_size = 10M
# read_rnd_buffer_size = 2M
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'
lower_case_table_names = 1
執(zhí)行以下腳本:
#!/bin/bash
echo "uninstall alisql ......"
cd /opt/alisql/
tar -zxf ncurses-5.9.tar.gz
cd /opt/alisql/ncurses-5.9/
./configure
cd /opt/alisql/ncurses-5.9/
make
make install
echo "install ncurses end "
cd /opt/alisql/
tar zxf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make
make install
echo "install cmake end ...... "
sleep 2
cd /opt/alisql/
tar zxf bison-2.7.tar.gz
cd bison-2.7
./configure
make -j 8
make install
echo "install bison end ...... "
sleep 2
cd /opt/alisql/
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /data/mysqldb
mkdir -p /opt/install
mkdir -p /opt/install/mysql
tar zxvf AliSQL-AliSQL-5.6.32-8.tar.gz
cd /opt/alisql/AliSQL-AliSQL-5.6.32-8/
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=3306 -DENABLE_DOWNLOADS=1
cd /opt/alisql/AliSQL-AliSQL-5.6.32-8/
make
make install
echo "change group ... "
cd /opt/install/mysql
chown -R mysql:mysql .
cd /data/mysqldb
chown -R mysql:mysql .
echo "init alisql ... "
cd /opt/install/mysql/
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
echo "cpoy my.cnf mysqld ... "
cp /opt/alisql/my.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
echo "change path ... "
sed -i '54i\export PATH=/opt/install/mysql/bin:/opt/install/mysql/lib:$PATH' /etc/profile
echo "restart path ... "
sleep 1
source /etc/profile
echo "start mysqld ... "
service mysqld start
echo "Power on start mysqld ... "
chkconfig --level 35 mysqld on
echo "stop firewalld ... "
systemctl stop firewalld
echo "install alisql end ... "
sleep 1
完成后通過netstat指令查看3306端口是否開啟,開啟即為成功,若失敗自行排查問題。
進(jìn)行數(shù)據(jù)庫配置和開啟遠(yuǎn)程連接進(jìn)行如下操作:
mysql -u root -p
use mysql;
select host,user, password from user;
update user set password=password('mypasswd'), host= '%' where user ='root' and host='127.0.0.1';
update user set password=password('mypasswd') where user ='root' and host='localhost';
flush privileges;
默認(rèn)安裝本地root登錄無密碼,第五行的修改語句將本地root登錄修改為自己的密碼。文章來源:http://www.zghlxwxcb.cn/news/detail-700054.html
希望以上對初入alisql的人有幫助!
?文章來源地址http://www.zghlxwxcb.cn/news/detail-700054.html
到了這里,關(guān)于Centos7離線安裝ALISQL5.6.32-8的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!