mysql
rpm -qa| grep mariadb
yum remove mariadb-libs
把下载好的 mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz 放到 /opt 目录下
tar -zxvf /opt/mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
mv /opt/mysql-5.7.37-linux-glibc2.12-x86_64 /usr/local/mysql
useradd -g mysql mysql
chown mysql.mysql -R /usr/local/mysql
在/usr/local/mysql/support-files/路径下创建 my.cnf
vim /usr/local/mysql/support-files/my_default.cnf
[ mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /tmp/mysql.sock
character-set-server= utf8
log-error = /usr/local/mysql/data/mysqld.log
pid-file = /usr/local/mysql/data/mysqld.pid
sql_mode = ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
cp /usr/local/mysql/support-files/my.cnf /etc/my.cnf
在 /usr/local/mysql/ 目录下 初始化mysql
./bin/mysqld --initialize --user= mysql --basedir= /usr/local/mysql/ --datadir= /usr/local/mysql/data/
vim /usr/local/mysql/data/mysqld.log
启动服务 (/mysql/support-files 目录下 )
[ root@seckill support-files]
[ root@seckill bin]
mysql> set password for root@localhost = password( '123456' ) ;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root' @'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit;
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
systemctl start mysqld
systemctl status mysqld