Step-by-Step Guide to Installing MySQL 5.7 on ARM (Aarch64) Linux
This tutorial walks you through checking the OS architecture, preparing the environment, downloading and extracting the MySQL 5.7 ARM package, configuring my.cnf, setting up auto‑start and environment variables, initializing the server, securing the root account, and configuring master‑slave replication on Linux.
1. Check the Operating System
<code># Verify architecture (amd64 or arm)
$ uname -a
Linux Server-58aa6d9e-9412-4ab6-b496-2adc0af4e9c8 4.19.90-17.5.ky10.aarch64
# View OS release information
$ cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Tercel)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Tercel)"
ANSI_COLOR="0;31"
</code>Note: MsSQL 8.0+ supports ARM; you can download a pre‑compiled package or use Docker.
2. Configure the Basic Environment
<code># Stop firewall and disable autostart
systemctl stop firewalld.service && systemctl disable firewalld.service && service iptables stop
# Disable SELinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
# Create mysql user and group (no login, no home)
groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
# Remove conflicting MariaDB packages
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-errmessage-10.3.9-9.p02.ky10.x86_64
rpm -qa | grep mysql
rpm -e --nodeps <existing-mysql-package>
</code>3. Download the Installation Package
<code># x86 package
https://downloads.mysql.com/archives/community/
# arm (aarch64) package
https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
</code>4. Upload and Install
Mount a data disk and use
/dataas the installation directory.
<code># Extract package to /data
tar -xvf mysql-5.7.27-aarch64.tar.gz -C /data/
# Rename directory
cd /data
mv mysql-5.7.27-aarch64/ mysql/
# Link configuration file
ln -sf /data/mysql/my.cnf /etc/my.cnf
# Create data directories
mkdir mysql_data mysql_tmp mysql_logs
# Set ownership
chown -R mysql:mysql /data/mysql /data/mysql_data /data/mysql_tmp /data/mysql_logs
# Copy libraries
cp -rf /data/mysql/extra/lib* /usr/lib64/
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.old
ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
</code>Modify my.cnf
<code>cd mysql
cp my.cnf my.cnf_bak # backup
vim /etc/my.cnf # edit
[client]
port = 3306
socket = /dev/shm/mysql.sock
[mysqld]
port = 3306
socket = /dev/shm/mysql.sock
basedir = /data/mysql
datadir = /data/mysql_data
log_bin = mysql-bin
pid-file = /data/mysql_data/mysql.pid
log_error = /data/mysql_logs/mysql-error.log
slow_query_log_file = /data/mysql_logs/mysql-slow.log
tmpdir = /data/mysql_tmp
user = mysql
bind-address = 0.0.0.0
server-id = 1
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
back_log = 300
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
binlog_format = mixed
expire_logs_days = 30
slow_query_log = 1
long_query_time = 1
performance_schema = 0
explicit_defaults_for_timestamp
lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
</code>Set Auto‑Start
<code>cp -rf /data/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
</code>Add Environment Variables
<code>vim /etc/profile
# Append the following lines
export MYSQL_HOME=/data/mysql
export PATH=$PATH:$MYSQL_HOME/bin
source /etc/profile
</code>Initialize and Start MySQL
<code># Initialize without password
mysqld --initialize-insecure --user=mysql --basedir=/data/mysql --datadir=/data/mysql_data
systemctl start mysqld
systemctl status mysqld
</code>Set Root Password and Allow Remote Access
<code>mysql -u root
use mysql;
update user set authentication_string=password("YOUR_PASSWORD") where user="root";
grant all privileges on *.* to root@'%' identified by "YOUR_PASSWORD";
flush privileges;
exit
</code>5. Master‑Slave Replication
Preparation
At least two servers (one master, one slave) with MySQL installed; server‑id must differ.
Both servers must allow traffic on port 3306.
Master Configuration
Modify
/etc/my.cnf(add):
<code># binlog-ignore-db=mysql
# binlog-ignore-db=information_schema
# binlog-ignore-db=performance_schema
# binlog-ignore-db=sys
log-bin=master-bin
server-id=1
log_bin_index = home/mysql/binlog/mysql-bin.index
</code>Create replication user:
<code>create user 'repl'@'%' identified by 'repl';
grант replication slave on *.* to 'repl'@'%';
service mysqld restart
</code>Get master status:
<code>show master status\G;
</code>Slave Configuration
Modify
/etc/my.cnf(add):
<code>server-id = 2
read_only = 1
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay-log = slave-relay-bin
</code>Restart service, then configure master info:
<code>CHANGE MASTER TO
MASTER_HOST = 'master_ip',
MASTER_USER = 'replication',
MASTER_PASSWORD = 'password',
MASTER_LOG_FILE = 'mysql-bin.000001',
MASTER_LOG_POS = 123;
START SLAVE;
SHOW SLAVE STATUS\G;
</code>Common Dump Commands
<code># Export a database
mysqldump -u username -p database_name > dumpfile.sql
# Export a single table
mysqldump -u username -p database_name table_name > table_dump.sql
</code>Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.