CentOS RPM Installation MySQL5.7

Source: Internet
Author: User
Tags safe mode uuid mysql login

Environment

CentOS 7 64-bit
MySQL 5.7 64-bit

1. Uninstalling the system's own mariadb
[[email protected] /]# rpm -qa|grep mariadbmariadb-libs-5.5.56-2.el7.x86_64[[email protected] /]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
2. Download RPM Package

Download the rpm bundle to the MySQL website and upload it locally to the server or download it directly from the server using the following method

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
3. Unzip the TAR package
[[email protected] softwares]# lsmysql-5.7.18-1.el7.x86_64.rpm-bundle.tar[[email protected] softwares]# tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar mysql-community-server-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.18-1.el7.x86_64.rpmmysql-community-devel-5.7.18-1.el7.x86_64.rpmmysql-community-client-5.7.18-1.el7.x86_64.rpmmysql-community-common-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.18-1.el7.x86_64.rpmmysql-community-libs-5.7.18-1.el7.x86_64.rpmmysql-community-server-minimal-5.7.18-1.el7.x86_64.rpmmysql-community-test-5.7.18-1.el7.x86_64.rpmmysql-community-minimal-debuginfo-5.7.18-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
4. Installation

Execute sequentially (several packages have dependencies, so execute successively) the following command installs

rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
5. Database initialization
mysqld --initialize --user=mysql

The--initialize option is initialized in "safe" mode by default, generates a password for the root user and marks the password as expired (password is in/var/log/mysqld.log), you need to set a new password after login, and use-- The initialize-insecure command does not use Safe mode, and a password is not generated for the root user.

[[email protected] softwares]# more /var/log/mysqld.log2018-02-24T08:27:17.789803Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-02-24T08:27:18.923811Z 0 [Warning] InnoDB: New log files created, LSN=457902018-02-24T08:27:18.981104Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2018-02-24T08:27:19.116973Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 87296646-193c-11e8-adaf-000c29ee8fae.2018-02-24T08:27:19.332937Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.2018-02-24T08:27:19.333647Z 1 [Note] A temporary password is generated for [email protected]: m)6_=8yl6(pA

The last line gives the MySQL login password.
Start the MySQL service and log in to MySQL

[[email protected] softwares]# systemctl start mysqld[[email protected] softwares]# mysql -u root -p Enter password: Welcome to the MySQL monitor.  
6. Reset the root user password

Prompt for password expiration, reset required

mysql> show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

Reset Password

7. Remote Authorization Login

Root User Name
% everyone has access to
Password Password

# 给特定IP授权GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.1.100‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;# 给任意IP授权GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;

Refresh Permissions

flush privileges;  
8. Configuring UTF8 Encoding

Modify the/ETC/MY.CNF and add the following to the back

[mysqld]character_set_server=utf8init_connect=‘SET NAMES utf8‘

Restart MySQL

systemctl restart mysqld

Display encoding

show variables like ‘%character%‘;

Reference Links:
1.https://my.oschina.net/laily/blog/713022
2.http://www.cnblogs.com/maobuji/p/8336702.html

CentOS RPM Installation MySQL5.7

Related Article

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.