一、上传二进制 mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz包
#/data 是数据盘 自己根据情况定
[root@VM_0_10_centos data]# pwd/datatar xf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.26-linux-glibc2.12-x86_64 mysql
#做软连接
ln -s /data/mysql /usr/local/mysqlcd /data/mysqlmkdir data
groupadd mysql
useradd -M -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
chown -R mysql.mysql /usr/local/mysql/rpm -qa | grep maria*
yum -y remove mari*#安装库
yum install -y libnuma*
二、mysql 初始化、启动、修改密码、开机自启动
[mysqld]
port=3306
character-set-server=utf8
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
#innodb_buffer_pool_size=8M
max_connections=1000
slow_query_log = 1
slow_query_log_file=/usr/local/mysql/log/mysql_slow_query.log
long_query_time = 5
max_connections=1000
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]log-error=/usr/local/mysql/data/error.logpid-file=/usr/local/mysql/data/mysql.pidtmpdir=/usr/local/mysql/tmp[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
[mysql]
default-character-set=utf8
# 初始化
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# 配置启动文件
cp ./support-files/mysql.server /etc/init.d/mysqldvim /etc/init.d/mysqld#basedir=/usr/local/mysql
#datadir=/usr/local/mysql/data
#mysqld_pid_file_path=/usr/local/mysql/data/mysql.pid
#启动数据库service mysqld start#修改密码./bin/mysql -u root -pSET PASSWORD FOR 'root'@localhost=PASSWORD('Your Password');#添加环境变量vim /etc/profileexport MYSQL_HOME=/usr/local/mysql
export PATH=$MYSQL_HOME/bin:$PATH#环境变量生效source /etc/profile
#开机自启动
[root@VM_0_14_centos mysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@VM_0_14_centos mysql]# chkconfig --add mysqld
[root@VM_0_14_centos mysql]# chkconfig --list mysqldNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd configuration.If you want to list systemd services use 'systemctl list-unit-files'.To see services enabled on particular target use'systemctl list-dependencies [target]'.mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# 如果是centos7 话可以检查一下
systemctl start mysqld
systemctl stop mysqld
systemctl status mysqld