mysql国内镜像地址:http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/
mysql官网地址:https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
#在根目录新建wwwcd /mkdir wwwcd www
tar -xvf mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
-- /usr/local 目录下创建文件夹存mkdir /usr/local/mysql--移动mv mysql-8.0.19-linux-glibc2.12-x86_64 /usr/local/mysql--添加mysql组和mysql用户--添加mysql组groupadd mysql--添加mysql用户useradd -r -g mysql mysql
--初始化mysql配置cd /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/datachown -R mysql:mysql /usr/local/mysql ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/datachown -R root:root /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql/data--复制配置文件cp /etc/my.cnf my.cnfchmod 777 ./my.cnfvi my.cnf---[mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/dataport=3306socket=/usr/local/mysql/tmp/mysql.socksql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES---
mkdir tmpchmod 777 tmp
--将mysql服务添加到/etc/init.dcp /support-files/mysql.server /etc/init.d/mysqlchmod +x /etc/init.d/mysql--添加服务chkconfig -add -mysql--查看是否添加成功chkconfig --list mysql
#查看mysql配置文件优先级 ./bin/mysql --help | grep ‘Default options‘ -A 1