Debian10二进制安装MySQL5.7

下载mysql5.7二进制包

        略

安装依赖

apt install psmisc libaio1 libnuma1 libatomic1 libmecab2 libncurses5

安装mysql

useradd -s /sbin/nologin -M mysql
tar -zxf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv /usr/local/mysql-5.7.35-linux-glibc2.12-x86_64 /usr/local/mysql

配置环境变量

vim /etc/profile


source /etc/profile

配置mysql参数

cat /etc/mysql/my.cnf
[mysqld_multi]
mysqld=/usr/local/mysql/bin/mysqld_safe
mysqladmin=/usr/local/mysql/bin/mysqladmin
log=/usr/local/mysql/mysqld_multi.log

[mysqld]
user=mysql
basedir=/usr/local/mysql
character_set_server=utf8mb4
collation_server=utf8mb4_general_ci
log_error=error.log
socket=mysqld.sock

[mysqld3306]
port=3306
datadir=/data/mysqld_3306

初始化实例

mkdir -p /data/mysqld_3306

bin/mysqld --user=mysql --datadir=/data/mysqld_3306 --initialize-insecure

启动实例

mysqld_multi report 
mysqld_multi start 3306
 

连接实例

mysql -S /data/mysqld_3306/mysqld.sock