Install mysql5.7.13 and centosmysql5.7.13 using RPM in CentOS 7

Source: Internet
Author: User
Tags mysql login

Install mysql5.7.13 and centosmysql5.7.13 using RPM in CentOS 7

0. Environment

Operating System: CentOS 7.2.1511 x86_64
MySQL version: 5.7.13

1. Uninstall the built-in mariadb-lib

[root@centos-linux ~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64[root@centos-linux ~]# rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64 --nodeps

2. Download the rpm installation package

Go to the official website to find the latest rpm collection package. Now the latest is mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
Copy it and download it from the server (or download it locally to the server ).

Copy codeThe Code is as follows: [root @ centos-linux ~] # Wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar

Decompress the package

[root@centos-linux ~]# lsmysql-5.7.13-1.el7.x86_64.rpm-bundle.tar[root@centos-linux ~]# tar xvf mysql-5.7.13-1.el7.x86_64.rpm-bundle.tarmysql-community-test-5.7.13-1.el7.x86_64.rpmmysql-community-embedded-5.7.13-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.13-1.el7.x86_64.rpmmysql-community-server-5.7.13-1.el7.x86_64.rpmmysql-community-client-5.7.13-1.el7.x86_64.rpmmysql-community-common-5.7.13-1.el7.x86_64.rpmmysql-community-server-minimal-5.7.13-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.13-1.el7.x86_64.rpmmysql-community-devel-5.7.13-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.13-1.el7.x86_64.rpmmysql-community-libs-5.7.13-1.el7.x86_64.rpmmysql-community-minimal-debuginfo-5.7.13-1.el7.x86_64.rpm

3. Installation
Execute the following commands in sequence (several packages have dependencies, so they are executed successively) to install

[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm

4. Database Initialization

In * nix system, to ensure that the database directory and file owner are mysql login users, if you run the mysql service as root, you need to execute the following command to initialize
Mysqld -- initialize -- user = mysql
If you are running as mysql, you can remove the -- user option.
In addition, the -- initialize option is initialized in "safe" mode by default. A password is generated for the root user and marked as expired. After login, you need to set a new password, the -- initialize-insecure command does not use the security mode, and does not generate a password for the root user.
The -- initialize initialization demonstrated here will generate a root account password. The password is in the log file.

The generated password is provided in the last line. Now you can start the database and then use the password above to log in.

[root@centos-linux ~]# systemctl start mysqld[root@centos-linux ~]# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.13Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

5. Modify the root password

The password is marked as expired. If you want to use it properly, you need to change the password.

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

The previous password () function will be discarded. We recommend that you use the following command to change the password.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

If the password you set is too simple, an error is returned.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123';ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

For more information about Setting Password rules, see this article.
Note that the password length must be greater than 8 and contain numbers, uppercase and lowercase letters, and special characters.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.