Ubuntu 24.04 二进制安装 GreatSQL
环境
操作系统版本:Ubuntu 24.04.1 LTS
GLIBC 版本:2.39
GreateSQL版本: GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64
# 这里要注意 glibc 的版本
安装
# 有很多系统优化可选项,可自行参考:https://greatsql.cn/docs/8.0.32-27/4-install-guide/1-install-prepare.html
# 修改mysql用户使用资源上限
cat >> /etc/security/limits.conf << EOF
mysql soft nofile 65535
mysql hard nofile 65535
mysql soft stack 32768
mysql hard stack 32768
mysql soft nproc 65535
mysql hard nproc 65535
EOF
# 下载
cd /usr/local
curl -o GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64.tar.xz https://product.greatdb.com/GreatSQL-8.0.32-27/GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64.tar.xz
tar xf GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64.tar.xz
# 安装所需的软件
apt update
apt-get install -y libaio-dev libnuma-dev libnuma1 net-tools openssl libssl-dev libjemalloc2 libjemalloc-dev libdigest-md5-perl
cat >> /etc/my.cnf << -'EOF'
[client]
socket = /data/GreatSQL/mysql.sock
[mysql]
loose-skip-binary-as-hex
prompt = "(\\D)[\\u@GreatSQL][\\d]>"
no-auto-rehash
[mysqld]
user = mysql
port = 3306
server_id = 3306
basedir = /usr/local/GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64
datadir = /data/GreatSQL
socket = /data/GreatSQL/mysql.sock
pid-file = mysql.pid
character-set-server = UTF8MB4
skip_name_resolve = ON
default_time_zone = "+8:00"
bind_address = "0.0.0.0"
secure_file_priv = /data/GreatSQL
server_id=82
log-bin
log_slave_updates=1
gtid_mode=ON
enforce_gtid_consistency=ON
-EOF
# 创建用户及目录
/sbin/groupadd mysql
/sbin/useradd -g mysql mysql -d /dev/null -s /sbin/nologin
mkdir -p /data/GreatSQL
chown -R mysql:mysql /data/GreatSQL
chmod -R 700 /data/GreatSQL
# 配置 PATH
echo 'export PATH=/usr/local/GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64/bin:$PATH' >> /etc/profile
source /etc/profile
# 初始化GreatSQL
mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql
# 配置 greatsql.service
cat >> /lib/systemd/system/greatsql.service << EOF
[Unit]
Description=GreatSQL Server
Documentation=https://greatsql.cn/docs/
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
# some limits
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=65535
# processes/threads
LimitNPROC=65535
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
User=mysql
Group=mysql
Type=simple
ExecStart=/usr/local/GreatSQL-8.0.32-27-Linux-glibc2.28-x86_64/bin/mysqld --defaults-file=/etc/my.cnf
Restart=on-failure
PrivateTmp=false
EOF
# 启动 greatesql
systemctl daemon-reload
systemctl start greatsql
systemctl status greatsql
# 设置开机启动
systemctl enable greatsql
# 设置密码
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Klvchen@2025';
flush privileges;
# 执行 ALTER 命令时可能会出现下面错误,稍等2分钟后再次执行就会成功,具体原因不明
ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
参考地址:
https://greatsql.cn/docs/8.0.32-27/3-quick-start/3-2-quick-start-with-tarball.html
https://greatsql.cn/docs/8.0.32-27/4-install-guide/3-2-ubuntu-install.html