CentOS 7 Yum Installation MySQL5.7

Source: Internet
Author: User
Tags mysql version

1, download the official MySQL Yum Repository, official address: https://dev.mysql.com/downloads/repo/yum/

Choose the right MySQL version from the MySQL website to get it.

Then use wget to download:

[Email protected] ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm--2017-10-19 04:44:56--  http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmResolving dev.mysql.com ( dev.mysql.com) ... 137.254.60.11

2. Install Yum Repository
[[email protected] ~]# lltotal 12-rw-r--r--. 1 root root 8984 Nov mysql57-community-release-el7-7.noarch.rpm[[email protected] ~]# yum-y Install mysql57 -community-release-el7-8.noarch.rpm Loaded plugins:fastestmirrorexamining Mysql57-community-release-el7-8.noarch.rpm:mysql57-community-release-el7-8.noarchmarking mysql57-community-release-el7-8.noarch.rpm to be installedresolving dependencies--> Running transaction Check--- > Package Mysql57-community-release.noarch 0:el7-8 'll be installed--> finished Dependency Resolutiondependencies resolved=========================================================================== Package Arch Version Repository size=================== ========================================================installing:mysql57-community-release Noarch el7-8 /mysql57-community-release-el7-8.noarch 8.2 ktransaction summary===========================================================================install 1 packagetotal size:8.2 kinstalled size:8.2 kDownloading Packages: Running transaction checkrunning Transaction testtransaction test succeededrunning transaction Installing:mysql57-comm  Unity-release-el7-8.noarch 1/1 Verifying:mysql57-community-release-el7-8.noarch 1/1 Installed:mysql57-community-release.noarch 0:el7-8 complete!

3. Install MySQL Server

View MySQL Server

[[email protected] ~]# yum search mysql-comloaded plugins:fastestmirrormysql-connectors-community | 2.5 KB 00:00 mysql-tools-community | 2.5 KB 00:00 mysql57-community |  2.5 KB 00:00 (1/3): mysql-connectors-community/x86_64/primary_db |  KB 00:00 (2/3): mysql-tools-community/x86_64/primary_db | KB 00:00 (3/3): mysql57-community/x86_64/primary_db | 124 KB 00:00 Loading mirror speeds from cached Hostfile * base:mirrors.btte.net * extras:mirrors.cn99.com * update s:mirrors.sohu.com========================= N/S matched:mysql-com ========================== Mysql-community-client.i686:mysql database client applications and TOOLSMYSQL-COMMUNITY-CLIENT.X86_64:MYSQL database Client applications And:toolsmysql-community-common.i686:mysql database Common files for                       Server and     : Client Libsmysql-community-common.x86_64:mysql database Common files for server and : Client libsmysql-community-devel.i686:development header files and libraries For:mysql dat                             Abase client Applicationsmysql-community-devel.x86_64:development header files and libraries for : MySQL Database client Applicationsmysql-community-embedded.i686:mysql embedded librarymysql-community-embedded.x8 6_64:mysql Embedded Librarymysql-community-embedded-compat.i686:mysql Embedded Compat Librarymysql-community-embedded-compat.x86_64:mysql Embedded Compat librarymysql-community-embedded-devel.i686: Development header files and ...: Libraries for MySQL as an embeddable librarymysql-community-embedded-devel.x86_64: Development header files and ...: Libraries for MySQL as an embeddable librarymysql-community-libs.i686:shared libra Ries for MySQL database client:applicationsmysql-community-libs.x86_64:shared Libraries for MySQL database CLIENT:APPLICATIONSM Ysql-community-libs-compat.i686:shared compat Libraries for MySQL 5.6.25:database Clie NT applicationsmysql-community-libs-compat.x86_64:shared compat libraries for MySQL: 5.6.37 Database client applicationsmysql-community-release.noarch:mysql repository configuration for Yummysql-community-server.x86_64:a very fast and reliable SQL Database:servermysql-commun Ity-test.x86_64:test Suite for the MySQL database server Name and summary matches only, use "Search all" for everything .

Installation

[Email protected] ~]# yum-y install mysql-community-server.x86_64loaded plugins:fastestmirrorloading mirror speeds fro M Cached Hostfile * base:mirrors.btte.net * extras:mirrors.cn99.com * updates:mirrors.sohu.comResolving dependencies--& Gt Running Transaction Check---> Package mariadb-server.x86_64 1:5.5.56-2.el7 would be obsoleted

Wait for the execution of the installation to complete.

4. Start the MySQL service

Then start, note that the CentOS7 start up in a different way than before, CentOS7 used the Systemctl

[Email protected] ~]# systemctl start Mysqld.service

To see if the launch was successful

[[email protected] ~]# systemctl status Mysqld.service mysqld.service- MySQL Server loaded:loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset:disabled) active:active (running) since Thu 2017-10-19 04:55:02 CST; 11s ago Docs:man:mysqld (8) http://dev.mysql.com/doc/refman/en/using-systemd.html process:4346 execstart=/  Usr/sbin/mysqld--daemonize--pid-file=/var/run/mysqld/mysqld.pid $MYSQLD _opts (code=exited, Status=0/SUCCESS) process:4271 execstartpre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/success) Main pid:4349 (mysqld) CGroup:/ System.slice/mysqld.service└─4349/usr/sbin/mysqld--daemonize--pid-file=/var/run/mysql ... OCT 04:54:58 Localhost.localdomain systemd[1]: Starting MySQL Server ...  OCT 04:55:02 localhost.localdomain systemd[1]: Started MySQL Server.Hint:Some lines were ellipsized, use-l to show in Full. 

The above active (running) indicates that it has started normally.

5. Login Database

Then you can enter the database, note here, MySQL5.7.6 will start the MySQL process to generate a user password, the first login requires this password. The password is stored in the log of the MySQL process, i.e. ( /var/log/mysqld.log )

View login Password

[Email protected] ~]# Cat/var/log/mysqld.log | grep ' password ' 2017-10-18t20:54:59.169015z 1 [Note] A temporary password is generated for [email protected]: i-<k&& gt;wb&0h*

Then log in

[Email protected] ~]# Mysql-uroot-penter password:welcome to the MySQL monitor.  

MySQL is fully installed here.

6. Change the root password

However, if you want to use the correct password, the previous password() function will be discarded, the official recommended to use the following command to modify the password

Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' new_password '; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

The password can't be too simple

Here we pay attention to setting the password length to be greater than 8, at the same time to have a number, case, special characters.

Finally, after installing the Repository that can remove MySQL, you can reduce the time that Yum checks for updates, using the following command.

[Email protected] ~]# yum-y Remove Mysql57-community-release-el7-8.noarch

CentOS 7 Yum 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.