Centos7 offline installation of MySQL

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.