美文网首页
MySQL5.7安装记录(CentOS6.9)

MySQL5.7安装记录(CentOS6.9)

作者: 丿SunnyR你這暱稱有點意思 | 来源:发表于2018-12-29 15:55 被阅读38次

    RPM指令

    RMP 是 LINUX 下的一种软件的可执行程序,你只要安装它就可以了。这种软件安装包通常是一个RPM包(Redhat Linux Packet Manager,就是Redhat的包管理器),后缀是.rpm。

    RPM是Red Hat公司随Redhat Linux推出了一个软件包管理器,通过它能够更加轻松容易地实现软件的安装。

    • 安装软件:执行rpm -ivh rpm包名
    <pre style="background-color: gray">
    
    [root@rhel6 opt]# rpm -ivh apache-1.3.6.i386.rpm
    
    </pre>
    
    * 升级软件:执行rpm -Uvh rpm包名
    * 反安装:执行rpm -e rpm包名
    * 查询软件包的详细信息:执行rpm -qpi rpm包名
    * 查询某个文件是属于那个rpm包的:执行rpm -qf rpm包名
    * 查该软件包会向系统里面写入哪些文件:执行 rpm -qpl rpm包名
    * 查看某个包是否被安装 rpm -qa | grep XXXX(moudle name)
    
    
    # 获取MySQL5.7安装包
    
    [MySQL Community Server 5.7.24](https://dev.mysql.com/downloads/mysql/5.7.html#downloads)
    
    filename:mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar
    
    
    1. 查询系统
    
    <pre style="background-color: gray">
    
    [root@rhel6.9]# rpm -qa|grep mysql
    mysql-libs-5.1.71-1.el6.x86_64
    [root@rhel6.9]#rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
    
    </pre>
    
    2. 解压TAR包
    
    <pre style="background-color: gray">
    
    [root@rhel6 opt]# tar -xf mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar
    [root@rhel6 opt]# ls
    mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar
    mysql-community-client-5.7.24-1.el6.x86_64.rpm
    mysql-community-common-5.7.24-1.el6.x86_64.rpm
    mysql-community-devel-5.7.24-1.el6.x86_64.rpm
    mysql-community-embedded-5.7.24-1.el6.x86_64.rpm
    mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm
    mysql-community-libs-5.7.24-1.el6.x86_64.rpm
    mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
    mysql-community-server-5.7.24-1.el6.x86_64.rpm
    mysql-community-test-5.7.24-1.el6.x86_64.rpm
    
    </pre>
    
    3. 如序安装RPM包
    
    <pre style="background-color: gray">
    
    [root@rhel6 opt]# rpm -ivh mysql-community-common-5.7.17-1.el6.x86_64.rpm
    [root@rhel6 opt]# rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm
    [root@rhel6 opt]# rpm -ivh mysql-community-client-5.7.17-1.el6.x86_64.rpm
    [root@rhel6 opt]# rpm -ivh mysql-community-devel-5.7.17-1.el6.x86_64.rpm
    [root@rhel6 opt]# rpm -ivh (/yum install -y) mysql-community-server-5.7.17-1.el6.x86_64.rpm
    
    </pre>
    
    4. Start MySQL5.7
    
    * Login with password
    
    <pre style="background-color: blue">
    
    /etc/init.d/mysqld start
    [root@rhel6 opt]# less /var/log/mysqld.log | grep password
    2018-11-23T11:48:43.363512Z 1 [Note] A temporary password is generated for root@localhost: GFd/ksNuG0NX
    
    </pre>
    
    * Login without password
    
    <pre style="background-color: gray">
    
    [root@rhel6 opt]# vim /etc/my.cnf
    add line content with ------>    skip-grant-tables(or skip-grant-tables=1)
    [root@rhel6 log]# vim /etc/my.cnf
    [root@rhel6 log]# service mysqld start
    Starting mysqld:                                           [  OK  ]
    [root@rhel6 log]# mysql -uroot -p
    Enter password: [Enter]
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.24 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    </pre>
    
    5. User password change processing
    
    <pre style="background-color: gray">
    
    [root@rhel6 log]# service mysqld start
    Starting mysqld:                                           [  OK  ]
    [root@rhel6 log]# mysql -uroot -p
    Enter password: [Enter]
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.24 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> show tables;
    +---------------------------+
    | Tables_in_mysql           |
    +---------------------------+
    | columns_priv              |
    | db                        |
    | engine_cost               |
    | event                     |
    | func                      |
    | general_log               |
    | gtid_executed             |
    | help_category             |
    | help_keyword              |
    | help_relation             |
    | help_topic                |
    | innodb_index_stats        |
    | innodb_table_stats        |
    | ndb_binlog_index          |
    | plugin                    |
    | proc                      |
    | procs_priv                |
    | proxies_priv              |
    | server_cost               |
    | servers                   |
    | slave_master_info         |
    | slave_relay_log_info      |
    | slave_worker_info         |
    | slow_log                  |
    | tables_priv               |
    | time_zone                 |
    | time_zone_leap_second     |
    | time_zone_name            |
    | time_zone_transition      |
    | time_zone_transition_type |
    | user                      |
    +---------------------------+
    31 rows in set (0.00 sec)
    
    <pre style="background-color: blue">
    
    mysql> update user set password=password('123456') where user='root';
    ERROR 1054 (42S22): Unknown column 'password' in 'field list'
    
    </pre>
    
    mysql> select database();
    +------------+
    | database() |
    +------------+
    | mysql      |
    +------------+
    1 row in set (0.00 sec)
    
    mysql> desc user;
    +------------------------+-----------------------------------+------+-----+-----------------------+-------+
    | Field                  | Type                              | Null | Key | Default               | Extra |
    +------------------------+-----------------------------------+------+-----+-----------------------+-------+
    | Host                   | char(60)                          | NO   | PRI |                       |       |
    | User                   | char(32)                          | NO   | PRI |                       |       |
    | Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
    | Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
    | Process_priv           | enum('N','Y')                     | NO   |     | N                     |       |
    | File_priv              | enum('N','Y')                     | NO   |     | N                     |       |
    | Grant_priv             | enum('N','Y')                     | NO   |     | N                     |       |
    | References_priv        | enum('N','Y')                     | NO   |     | N                     |       |
    | Index_priv             | enum('N','Y')                     | NO   |     | N                     |       |
    | Alter_priv             | enum('N','Y')                     | NO   |     | N                     |       |
    | Show_db_priv           | enum('N','Y')                     | NO   |     | N                     |       |
    | Super_priv             | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N                     |       |
    | Lock_tables_priv       | enum('N','Y')                     | NO   |     | N                     |       |
    | Execute_priv           | enum('N','Y')                     | NO   |     | N                     |       |
    | Repl_slave_priv        | enum('N','Y')                     | NO   |     | N                     |       |
    | Repl_client_priv       | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_view_priv       | enum('N','Y')                     | NO   |     | N                     |       |
    | Show_view_priv         | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_routine_priv    | enum('N','Y')                     | NO   |     | N                     |       |
    | Alter_routine_priv     | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_user_priv       | enum('N','Y')                     | NO   |     | N                     |       |
    | Event_priv             | enum('N','Y')                     | NO   |     | N                     |       |
    | Trigger_priv           | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_tablespace_priv | enum('N','Y')                     | NO   |     | N                     |       |
    | ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |                       |       |
    | ssl_cipher             | blob                              | NO   |     | NULL                  |       |
    | x509_issuer            | blob                              | NO   |     | NULL                  |       |
    | x509_subject           | blob                              | NO   |     | NULL                  |       |
    | max_questions          | int(11) unsigned                  | NO   |     | 0                     |       |
    | max_updates            | int(11) unsigned                  | NO   |     | 0                     |       |
    | max_connections        | int(11) unsigned                  | NO   |     | 0                     |       |
    | max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
    | plugin                 | char(64)                          | NO   |     | mysql_native_password |       |
    | authentication_string  | text                              | YES  |     | NULL                  |       |
    | password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
    | password_last_changed  | timestamp                         | YES  |     | NULL                  |       |
    | password_lifetime      | smallint(5) unsigned              | YES  |     | NULL                  |       |
    | account_locked         | enum('N','Y')                     | NO   |     | N                     |       |
    +------------------------+-----------------------------------+------+-----+-----------------------+-------+
    45 rows in set (0.00 sec)
    
    <pre style="background-color: blue">
    
    mysql> update user set authentication_string=password('123456') where user='root';
    //notice:stament update user set password=password('123456') where user='root' is useless for Field *authentication_string* existing.
    Query OK, 1 row affected, 1 warning (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 1
    
    </pre>
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> quit
    Bye
    [root@rhel6 log]# service mysqld stop
    Stopping mysqld:                                           [  OK  ]
    [root@rhel6 log]# vim /etc/my.cnf
    [root@rhel6 log]# service mysqld start
    Starting mysqld:                                           [  OK  ]
    [root@rhel6 log]# mysql -uroot -p123456
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.24
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> show databases;
    
    </pre>
    
    but #1 problem occurs as follow:
    
    <pre style="background-color: blue">
    
    [Problem]
    
    mysql> show databases;
    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    
    [Solution]
    
    mysql> alter user 'root'@'localhost' identified by '123456';(or ALTER USER USER() IDENTIFIED BY '123456';)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    </pre>
    
    and then #2 problem occurs as follow:
    
    <pre style="background-color: blue">
    
    [Problem]
    
    mysql> alter user 'root'@'localhost' identified by '123456';
    ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    
    [Reason]
    
    MySQL5.7 concluds plugin activated: validate_password
    
    [Solution]
    
    mysql> set global validate_password_policy=0;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> set global validate_password_length=1;(or set global validate_password_length=0)
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> select @@validate_password_policy;
    +----------------------------+
    | @@validate_password_policy |
    +----------------------------+
    | LOW                        |
    +----------------------------+
    1 row in set (0.00 sec)
    
    mysql> select @@validate_password_length;
    +----------------------------+
    | @@validate_password_length |
    +----------------------------+
    |                          4 |
    +----------------------------+
    1 row in set (0.00 sec)
    
    
    </pre>
    
    and then
    
    <pre style="background-color: gray">
    
    [root@rhel6 log]# mysql -uroot -p123456
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4
    Server version: 5.7.24 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    +--------------------+
    4 rows in set (0.00 sec)
    
    mysql>   \q
    Bye
    
    </pre>
    
    ---
    
    ALL DONE!
    
    
    > Related Official Page:
    
    [Installing MySQL on Linux Using the MySQL Yum Repository](https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html)
    
    [MySQL Repo](http://repo.mysql.com/)
    
    ---
    
    > Related Blog Page
    
    [centos安装MySQL5.7](https://www.cnblogs.com/xiami-mj/p/6978650.html)
    
    [CentOS下的Mysql的安装和使用](https://www.cnblogs.com/suxiaoman/p/7693066.html)
    
    [CentOS6.9安装mysql5.7排错 需要 libc.so.6 GLIBC2.14](https://blog.csdn.net/YHF886/article/details/82190688)
    
    [mysql5.7系列修改root默认密码](https://www.cnblogs.com/activiti/p/7810166.html)
    
    [mysql出现ERROR 1819 (HY000)的解决方法](https://www.jb51.net/article/95399.htm)
    
    ---
    
    > Related soultion to specific problem
    
    <pre style="background-color: gray">
    
    [Problem]
    
    Error: Package: mysql-community-server-5.6.40-2.el7.x86_64 (mysql56-community)
               Requires: libc.so.6(GLIBC_2.17)(64bit)
    Error: Package: mysql-community-server-5.6.40-2.el7.x86_64 (mysql56-community)
               Requires: systemd
    Error: Package: mysql-community-libs-5.6.40-2.el7.x86_64 (mysql56-community)
               Requires: libc.so.6(GLIBC_2.17)(64bit)
    Error: Package: mysql-community-server-5.6.40-2.el7.x86_64 (mysql56-community)
               Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
    Error: Package: mysql-community-client-5.6.40-2.el7.x86_64 (mysql56-community)
               Requires: libc.so.6(GLIBC_2.17)(64bit)
     You could try using --skip-broken to work around the problem
     You could try running: rpm -Va --nofiles --nodigest
    
    [Solution]
    <pre style="background-color: blue">
    
    #yum install glibc.i686
    #yum list libstdc++*
    
    </pre>
    
    </pre>
    
    # The easy way to install MySQL5.7 on Red Hat Enterprise Linux 6.9
    Without yum install any <kbd>mysql*...*noarch.rpm<kbd>, we just follow
    the instruction on this page [Installing MySQL on Linux Using the MySQL Yum Repository](https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html) and editting
    
    * Selecting a Release Series
    
    <pre style="background-color: blue">
    
    [Filename:    /etc/yum.repos.d/MySQL57.repo]
    [commonuser@rhel6 yum.repos.d]$ cat MySQL.repo 
    [MySQl57-community]
    name=MySQL 5.7 Community Server
    baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    </pre>
    
    * Installing MySQL
    
    <pre style="background-color: gray">
    
    <pre style="background-color: blue">
    
    [root@rhel6 op-dir]# yum install -y mysql-community-server 
    
    </pre>
    
    [root@rhel6 op-dir]# yum install -y mysql-community-server 
    Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
                  : subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-community-server.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-common(x86-64) = 5.7.24-1.el6 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Running transaction check
    ---> Package mysql-community-client.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.24-1.el6.x86_64
    ---> Package mysql-community-common.x86_64 0:5.7.24-1.el6 will be installed
    --> Running transaction check
    ---> Package mysql-community-libs.x86_64 0:5.7.24-1.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package                   Arch      Version         Repository            Size
    ================================================================================
    Installing:
     mysql-community-server    x86_64    5.7.24-1.el6    MySQl57-community    153 M
    Installing for dependencies:
     mysql-community-client    x86_64    5.7.24-1.el6    MySQl57-community     23 M
     mysql-community-common    x86_64    5.7.24-1.el6    MySQl57-community    332 k
     mysql-community-libs      x86_64    5.7.24-1.el6    MySQl57-community    2.1 M
    
    Transaction Summary
    ================================================================================
    Install       4 Package(s)
    
    Total size: 178 M
    Installed size: 887 M
    Downloading Packages:
    warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    
    GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    [root@rhel6 op-dir]# gpg --recv-keys 5072E1F5
    gpg: requesting key 5072E1F5 from hkp server keys.gnupg.net
    gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle.com>" not changed
    gpg: Total number processed: 1
    gpg:              unchanged: 1
    [root@rhel6 op-dir]# vim mysql_pubkey.asc
    [root@rhel6 op-dir]# gpg --import mysql_pubkey.asc 
    gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle.com>" not changed
    gpg: Total number processed: 1
    gpg:              unchanged: 1
    [root@rhel6 op-dir]# yum install -y mysql-community-server 
    Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
                  : subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-community-server.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-common(x86-64) = 5.7.24-1.el6 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Running transaction check
    ---> Package mysql-community-client.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.24-1.el6.x86_64
    ---> Package mysql-community-common.x86_64 0:5.7.24-1.el6 will be installed
    --> Running transaction check
    ---> Package mysql-community-libs.x86_64 0:5.7.24-1.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package                   Arch      Version         Repository            Size
    ================================================================================
    Installing:
     mysql-community-server    x86_64    5.7.24-1.el6    MySQl57-community    153 M
    Installing for dependencies:
     mysql-community-client    x86_64    5.7.24-1.el6    MySQl57-community     23 M
     mysql-community-common    x86_64    5.7.24-1.el6    MySQl57-community    332 k
     mysql-community-libs      x86_64    5.7.24-1.el6    MySQl57-community    2.1 M
    
    Transaction Summary
    ================================================================================
    Install       4 Package(s)
    
    Total size: 178 M
    Installed size: 887 M
    Downloading Packages:
    warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    
    GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    </pre>
    
    So, the #1 problem occurs about GPG-Key, refer to [Installing MySQL on Linux Using the MySQL Yum Repository](https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html), we find [Signature Checking Using GnuPG](https://dev.mysql.com/doc/refman/5.7/en/checking-gpg-signature.html)
    
    <pre style="background-color: gray">
    
    <pre style="background-color: blue">
    
    saved the key in a file named mysql_pubkey.asc
    [root@rhel6 op-dir]# vim mysql_pubkey.asc
    
    As it declars:
    
    If you want to import the key into your RPM configuration to validate RPM install packages, you should be able to import the key directly:
    
    [root@rhel6 op-dir]# rpm --import mysql_pubkey.asc
    
    </pre>
    
    [root@rhel6 op-dir]# yum install -y mysql-community-server 
    Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
                  : subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-community-server.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-common(x86-64) = 5.7.24-1.el6 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.24-1.el6.x86_64
    --> Running transaction check
    ---> Package mysql-community-client.x86_64 0:5.7.24-1.el6 will be installed
    --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.24-1.el6.x86_64
    ---> Package mysql-community-common.x86_64 0:5.7.24-1.el6 will be installed
    --> Running transaction check
    ---> Package mysql-community-libs.x86_64 0:5.7.24-1.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package                   Arch      Version         Repository            Size
    ================================================================================
    Installing:
     mysql-community-server    x86_64    5.7.24-1.el6    MySQl57-community    153 M
    Installing for dependencies:
     mysql-community-client    x86_64    5.7.24-1.el6    MySQl57-community     23 M
     mysql-community-common    x86_64    5.7.24-1.el6    MySQl57-community    332 k
     mysql-community-libs      x86_64    5.7.24-1.el6    MySQl57-community    2.1 M
    
    Transaction Summary
    ================================================================================
    Install       4 Package(s)
    
    Total size: 178 M
    Installed size: 887 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : mysql-community-common-5.7.24-1.el6.x86_64                   1/4 
      Installing : mysql-community-libs-5.7.24-1.el6.x86_64                     2/4 
      Installing : mysql-community-client-5.7.24-1.el6.x86_64                   3/4 
      Installing : mysql-community-server-5.7.2 [###########                  ] 4/4
    
    
    
      Installing : mysql-community-server-5.7.2 [############                 ] 4/4
    
    
      Installing : mysql-community-server-5.7.24-1.el6.x86_64                   4/4 
      Verifying  : mysql-community-server-5.7.24-1.el6.x86_64                   1/4 
      Verifying  : mysql-community-common-5.7.24-1.el6.x86_64                   2/4 
      Verifying  : mysql-community-libs-5.7.24-1.el6.x86_64                     3/4 
      Verifying  : mysql-community-client-5.7.24-1.el6.x86_64                   4/4 
    
    Installed:
      mysql-community-server.x86_64 0:5.7.24-1.el6                                  
    
    Dependency Installed:
      mysql-community-client.x86_64 0:5.7.24-1.el6                                  
      mysql-community-common.x86_64 0:5.7.24-1.el6                                  
      mysql-community-libs.x86_64 0:5.7.24-1.el6                                    
    
    Complete!
    
    
    </pre>
    
    * Starting the MySQL Server
    
    <pre style="background-color: pink">
    
    [root@rhel6 op-dir]# service mysqld start
    Initializing MySQL database:                               [  OK  ]
    Starting mysqld:                                           [  OK  ]
    
    </pre>
    
    At the initial start up of the server, the following happens, given that the data directory of the server is empty:
    
        * The server is initialized.
    
        * SSL certificate and key files are generated in the data directory.
    
        * validate_password is installed and enabled.
    
    A superuser account 'root'@'localhost is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:
    
    <pre style="background-color: pink">
    
    shell> sudo grep 'temporary password' /var/log/mysqld.log
    
    </pre>
    
    Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:
    
    <pre style="background-color: pink">
    
    shell> mysql -uroot -p
    
    <pre style="background-color: gray">
    
    [root@rhel6 op-dir]# mysql -uroot -p
    Enter password: [Get from temporary password in /var/log/mysqld.log]
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.24
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    </pre>
    
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
    
    shell> flush privileges;
    
    </pre>
    
    > Note
    
    > *validate_password* is installed by default. The default password policy implemented by *validate_password* requires that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.
    
    <pre style="background-color: blue">
    
    mysql> set global validate_password_policy=0;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> set global validate_password_length=0;
    Query OK, 0 rows affected (0.01 sec)
    
    </pre>
    
    

    相关文章

      网友评论

          本文标题:MySQL5.7安装记录(CentOS6.9)

          本文链接:https://www.haomeiwen.com/subject/secplqtx.html