This is not written by me. It is written by
a big guy.
I don’t know who it is . I just saw the installation steps. I feel good and I shared it. If there is any infringement problem, please contact me directly and I will delete the post immediately
. Start the installation below
1. Uninstall mariadb, otherwise there will be conflicts when installing mysql
Excuting an order
rpm -qa | grep mariadb
List all installed mariadb rpm packages;
Excuting an order
rpm -e --nodeps package name (for example: rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64)
Uninstall all the listed mariadb rpm packages one by one
2. Add official yum source
Take centos7 to install mysql5.6 as an example:
Create and edit the mysql-community.repo file
vi /etc/yum.repos.d/mysql-community.repo
Paste the following content in and save
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Note: gpgcheck is a GPG encryption check. In the official document, the value is 1, but check will report an error, so here is changed to 0 to skip the check, which has no effect on the installation.
In the same way, other centos versions to install other versions of mysql only need to be changed to the corresponding baseurl:
centos7安装mysql5.7:baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
centos6安装mysql5.6:baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
centos6安装mysql5.7:baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
3. Installation
Excuting an order
sudo yum install mysql-community-server
4. Start
Excuting an order
sudo service mysqld start
5. Change the root password of mysql
mysqladmin -u root -p password your new password
The initial password is empty, just press enter
Note: The initial password of mysql5.7 is randomly generated and placed in /var/log/mysqld.log
Use the command grep'temporary password' /var/log/mysqld.log to read it out.
Okay, then you can use it directly, give it a try