yum方式安装mysql
1、Adding the MySQL Yum Repository
centos 6
rpm -Uvh https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm
centos 7
rpm -Uvh https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2、Selecting a Release Series
yum repolist all | grep mysql
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
注:提示命令不存在,yum install yum-utils -y
3、Installing MySQL
yum install mysql-community-server
4、Starting the MySQL Server
centos 6
service mysqld start
centos 7
systemctl start mysqld.service
5、Securing the MySQL Installation (for MySQL 5.6 only)
mysql_secure_installation
6、MySQL Server Initialization (for MySQL 5.7 only)
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
7、Installing Additional MySQL Products and Components
yum --disablerepo=\* --enablerepo='mysql*-community*' list available
yum install package-name
8、list all the installed packages for the MySQL components
yum list installed | grep "^mysql"
官方地址:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/