1. Unzip the downloaded compression package, you will get some RPM packages, or you can download the following four RPM packages directly, because the other RPM packages are not required
mysql-community-common-5.7.11-1.el7.i686.rpm
mysql-community-libs-5.7.11-1.el7.i686.rpm
mysql-community-client-5.7.11-1.el7.i686.rpm
mysql-community-server-5.7.11-1.el7.i686.rpm
2. Uninstalling MARIADB
If you click on the RPM package installation you will get an error message. Because the CentOS default database is no longer MySQL, but mariadb, why?
MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL.
View current system-installed MARIADB packages
grep mariadb
Uninstall all the MARIADB packages
[[email protected] Download]# rpm-e mariadb-libs
will report an error that relies on detection failure
Perform a forced uninstallation
[Email protected] Desktop]# rpm-e--nodeps mariadb-libs
3. Install MySQL
[Email protected] Desktop]# RPM-IVH mysql-community-common-5.7. One-1-ivh mysql-community-libs-5.7. One-1-ivh mysql-community-client-5.7. One-1-ivh mysql-community-server-5.7. One-1. el7.i686.rpm
Tip: You may experience dependency detection failures during installation as follows
Installing MySQL dependency can
[[email protected] Desktop]# yuminstall libaio.so. 1
4. Start MySQL
[Email protected] Desktop]# systemctl start Mysqld.service
If the error (I did not error) error! The server quit without updating PID file
is because SELinux, if it is a centos system, will turn on SELinux by default. The workaround is to close it, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine.
Restart MySQL
[Email protected] Desktop]# systemctl restart Mysqld.service
View MySQL Status
[Email protected] Desktop]# systemctl status Mysqld.service
5. Log in with the root user
5.1 MySQL 5.7 After initial installation (CentOS7 operating system) will generate a random initial password, and in the/var/log/mysqld.log record, can be viewed through the more command, find the password keyword
5.2 can also skip password detection after entering MySQL and then change the root password
Online See with mysqld_safe command, but I installed the MySQL5.7.11 did not find this command, to the official website found the following results
That is to say Mysqld_safe from MySQL5.7.6 has not installed, that can not use Mysqld_safe.
The workaround is to add skip-grant-tables=1under [mysqld] by editing the/etc/my.cnf file and restart the MySQL service.
Log in to MySQL as root
[[Email protected] Desktop]# mysql-u root
Go to MySQL Database
mysql> use MySQL;
Change Root's password to root
MySQL>updateuserset= password ('root' ), password_expired='N', password_last_changed=where user='root';
Quit MySQL, edit the/etc/my.cnf file again, delete the Skip-grant-tables=1 you just added, and then restart the MySQL service.
6. Open 3306 Ports
If you want to connect your MySQL to another host, you need to open port 3306.
[[Email protected] Desktop]# firewall-cmd--zone=public--add-port=3306/tcp--permanent[[email protected] Desktop]# Firewall-cmd--reload
CentOS7 installation MySQL5.7.11