Quick install test version Mysql and test version Mysql

Source: Internet
Author: User
Tags mysql login

Quick install test version Mysql and test version Mysql

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. Which of the following ismysql-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 ).

[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--user.

In addition--initializeOption 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.--initialize-insecureThe command does not use the security mode, so a password is not generated for the root user.

The--initializeDuring initialization, a root account password is generated. The password is in the log file.

[root@centos-linux ~]# cat /var/log/mysqld.log2016-07-16T07:56:38.282824Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-07-16T07:56:38.422114Z 0 [Warning] InnoDB: New log files created, LSN=457902016-07-16T07:56:38.449315Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2016-07-16T07:56:38.457910Z 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: d3261dbf-4b2a-11e6-86ef-001c4260563f.2016-07-16T07:56:38.458976Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2016-07-16T07:56:38.459524Z 1 [Note] A temporary password is generated for root@localhost: hm9dKgzQdm:W

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.

Previouspassword()The 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 '000000'; ERROR 123 (HY000): Your password does not satisfy the current policy requirements

Tip: the password should be complex and the security should be the first !!

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.