1, install the new version of MySQL before the system to bring the Mariadb-lib uninstall
Rpm-qa|grep mariadb
[[Email protected]]# mariadb-libs-5.5.44-2.el7.centos.x86_64
RPM-E--nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
2. Download MySQL offline package
: https://dev.mysql.com/downloads/mysql/#downloads
Decompression: Tar xvf Mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
3. Installation
Install in sequence using the RPM-IVH command
RPM-IVH mysql-community-common-5.7.16-1.el7.x86_64.rpm
RPM-IVH mysql-community-libs-5.7.16-1.el7.x86_64.rpm
RPM-IVH mysql-community-client-5.7.16-1.el7.x86_64.rpm
RPM-IVH mysql-community-server-5.7.16-1.el7.x86_64.rpm
4. Initialize the database
Specify DataDir, Generate (~/.mysql_secret) or (/var/log/mysqld.log) password file after execution
[Email protected]]# mysqld--initialize--datadir=/var/lib/mysql
5. Change the user and the group to which the MySQL database directory belongs, and start the MySQL database
[Email protected]]# chown Mysql:mysql/var/lib/mysql-r
[[Email protected]]# systemctl start Mysqld.service
6. log in to MySQL and change the root user's password
Password to view the initial password via the cat ~/.mysql_secret command
[Email protected] mytmp]# mysql-uroot-p
Enter Password:
Mysql> set Password=password (' MySQL ');
7. Set up MySQL Boot
Check if the boot is already on
Systemctl List-unit-files | grep mysqld
Boot up
Systemctl Enable Mysqld.service
8, create users, assign permissions, remote login authorization
Mysql-uroot-pmysql
GRANT all privileges on * * to ' root ' @ '% ' identified by ' MySQL ' with GRANT OPTION;
FLUSH privileges;
Initializing the Hive Library
Mysql-u Root-pmysql
CREATE USER ' hive ' @ '% ' identified by ' hive ';
GRANT all privileges on * * to ' hive ' @ '% ';
CREATE USER ' hive ' @ ' localhost ' identified by ' hive ';
GRANT all privileges on * * to ' hive ' @ ' localhost ';
CREATE USER ' hive ' @ ' host-name ' identified by ' hive ';
GRANT all privileges on * * to ' hive ' @ ' host-name ';
FLUSH privileges;
CREATE DATABASE ' hive ' DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
Centos7 offline installation of MySQL