#将MySQL的安装包提前上传到Linux的/export/software目录 cd /export/software tar -zxvf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz -C /export/server/
cd /export/server mv mysql-5.7.29-linux-glibc2.12-x86_64 mysql-5.7.29
groupadd mysql useradd -r -g mysql mysql
chown -R mysql:mysql /export/server/mysql-5.7.29/
cp /export/server/mysql-5.7.29/support-files/mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql
basedir=/export/server/mysql-5.7.29 datadir=/export/server/mysql-5.7.29/data
vim /etc/my.cnf
[client] port=3306 default-character-set=utf8 [mysqld] basedir=/export/server/mysql-5.7.29 datadir=/export/server/mysql-5.7.29/data port=3306 character-set-server=utf8 default_storage_engine=InnoDB
/export/server/mysql-5.7.29/bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql --basedir=/export/server/mysql-5.7.29 --datadir=/export/server/mysql-5.7.29/data
service mysql start
/export/server/mysql-5.7.29/bin/mysql -uroot -p
set password=password('123456');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'; flush privileges;
vim /etc/profile
export MYSQL_HOME=/export/server/mysql-5.7.29 export PATH=$PATH:$MYSQL_HOME/bin
source /etc/profile
chkconfig --add mysql #mysql服务到自启服务 chkconfig mysql on #设置自启
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动
vim /etc/selinux/config
#该选项默认是: SELINUX=enforcing,修改为以下值 SELINUX=disabled
OK啦!