CentOS安装MySQL
一、配置yum源
$ rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
$ yum clean all && yum makecache fast && yum repolist
二、安装MySQL
$ yum -y install mysql-community-server --nogpgcheck
三、启动MySQL
[root@kvm01 ~]
mysql Ver 14.14 Distrib 5.7.40, for Linux (x86_64) using EditLine wrapper
systemctl start mysqld && systemctl enable mysqld && systemctl daemon-reload
$ grep 'temporary password' /var/log/mysqld.log
2022-12-22T11:27:06.475037Z 1 [Note] A temporary password is generated for root@localhost: f-iSa-_E&9ed
四、设置字符集并开启远程登录
$ vim /etc/my.cnf
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
systemctl restart mysqld && systemctl daemon-reload
$ mysql -uroot -p >> -EOF
$ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Admin@123' WITH GRANT OPTION;
$ FLUSH PRIVILEGES;