This article was written on 2017-05-20, using MySQL-5.7.18. The operating system is 64-bit CentOS Linux release 7.2.1511 (Core), installed in desktop mode.
Uninstall MariaDBCentOS7 installs MariaDB by default instead of MySQL, and MySQL-related software packages are also removed from the yum server. Because MariaDB and MySQL may conflict, uninstall MariaDB first. View the installed MariaDB related rpm packages.rpm -qa | grep mariadb
rpm command.
yum list mariadb-libs
yum list command. This step requires root privileges.
yum remove mariadb-libs
to search for the corresponding rpm download link.
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
rpm command must be executed in order.
mkdir mysql-5.7.18 tar -xv -f mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.18 cd mysql-5.7.18/ rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
delete the installation files and temporary files.
cd .. rm -rf mysql-5.7.18 rm mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
configuration file /etc/my.cnf to make MySQL skip the login permissions test. Add a line:
<p style="margin-bottom: 7px;">skip-grant-tables<br/></p>
service mysqld restart
mysql
use mysql; UPDATE user SET authentication_string = password('your-password') WHERE host = 'localhost' AND user = 'root'; quit;
/etc/my.cnfDelete the previous
Addthat lineskip-grant-tables, and restart MySQL. This step is very important, failure to perform it may lead to serious
security issues.
mysql -u root -p
ALTER USER root@localhost IDENTIFIED BY 'your-new-password';
The above is the detailed content of Detailed introduction on how to use rpm package to install MySQL on CentOS7. For more information, please follow other related articles on the PHP Chinese website!