MySQL :: Download MySQL Yum Repository
rpm -vih rpmName
vi /etc/yum.repo.d/mysql-community-source.repo
[mysql80-community-source] name=MySQL 8.0 Community Server - Source baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/SRPMS enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
yum clean all
yum repolist
yum install mysql-community-server -y
cd /opt && tar zxvf localyum.tar.gz
mkdir /etc/yum.repos.d/back mv CentOS*.repo back
cat <<EOF>> /etc/yum.repos.d/mysql8.repo [mysql80-community] name=MySQL 8.0 Community Server baseurl=file:///opt/localyum/ enabled=1 gpgcheck=0 EOF
yum clean all
yum repolist
yum install mysql-community-server -y
yum install bzip2 gcc gcc-c++ git centos-release-scl epel-release -y yum install devtoolset-10 cmake3 ncurses-devel openssl-devel -y
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.26.tar.gz
tar xvf mysql-boost-8.0.26.tar.gz
cd mysql-8.0.26
cmake3 . \ -DWITH_BOOST=./boost/ \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/data/mysql/mysql3306/data \ -DSYSCONFDIR=/ \ -DWITH_DEBUG=1 \ -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 \ -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \ -DFORCE_INSOURCE_BUILD=1
make -j4 && make install
建议运行内存4G及以上
systemctl start mysqld
cat /var/log/mysqld.log | grep rootg
结果
2021-10-27T08:45:24.794599Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: F-h=4.j%nWky
mysql -uroot -p'F-h=4.j%nWky'
任选其一
mysqladmin -uroot -p password 'MyNewPass@123'
此处提示 Enter password:输入旧密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass@123';