mysql8 安装过程全纪录

Welcome to Alibaba Cloud Elastic Compute Service !

[root@admin ~]# ll
total 56432
-rw-r--r-- 1 root root    26024 Apr 25  2019 mysql80-community-release-el7-3.noarch.rpm
-rw------- 1 root root     2206 Nov  7 16:20 nohup.out
[root@admin ~]# rm mysql80-community-release-el7-3.noarch.rpm
rm: remove regular file ‘mysql80-community-release-el7-3.noarch.rpm’? y
[root@admin ~]# rm nohup.out
rm: remove regular file ‘nohup.out’? y
[root@admin ~]# ll
total 56400
-rw-r--r-- 1 root root 57750061 Nov  7 16:15 aimee-ocr-0.0.1-SNAPSHOT.jar
[root@admin ~]# cd /data/apps/
[root@admin apps]# ll
total 1688
drwxrwxr-x 6 root root    4096 Nov  7 21:38 redis-4.0.6
-rw-r--r-- 1 root root 1723533 Dec  5  2017 redis-4.0.6.tar.gz
[root@admin apps]# mkdir mysql
[root@admin apps]# cd mysql/
[root@admin mysql]# ll
total 0
[root@admin mysql]# wget -i -c https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
--2019-11-08 17:58:34--  https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.1.245.43
Connecting to repo.mysql.com (repo.mysql.com)|23.1.245.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25548 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-10.noarch.rpm’

100%[===========================================================================================================================================================================================================================>] 25,548      --.-K/s   in 0.1s    

2019-11-08 17:58:35 (201 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm’ saved [25548/25548]

-c: No such file or directory
No URLs found in -c.
FINISHED --2019-11-08 17:58:35--
Total wall clock time: 1.0s
Downloaded: 1 files, 25K in 0.1s (201 KB/s)
[root@admin mysql]# http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
-bash: http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm: No such file or directory
[root@admin mysql]# https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
-bash: https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm: No such file or directory
[root@admin mysql]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--2019-11-08 17:59:25--  http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm [following]
--2019-11-08 17:59:26--  https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm [following]
--2019-11-08 17:59:27--  https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.1.245.43
Connecting to repo.mysql.com (repo.mysql.com)|23.1.245.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25548 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-10.noarch.rpm.1’

100%[===========================================================================================================================================================================================================================>] 25,548      63.2KB/s   in 0.4s   

2019-11-08 17:59:29 (63.2 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm.1’ saved [25548/25548]

-c: No such file or directory
No URLs found in -c.
FINISHED --2019-11-08 17:59:29--
Total wall clock time: 3.4s
Downloaded: 1 files, 25K in 0.4s (63.2 KB/s)
[root@admin mysql]# wget -i -c https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
--2019-11-08 17:59:41--  https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.1.245.43
Connecting to repo.mysql.com (repo.mysql.com)|23.1.245.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25548 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-10.noarch.rpm.2’

100%[===========================================================================================================================================================================================================================>] 25,548      --.-K/s   in 0.1s    

2019-11-08 17:59:42 (202 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm.2’ saved [25548/25548]

-c: No such file or directory
No URLs found in -c.
FINISHED --2019-11-08 17:59:42--
Total wall clock time: 1.0s
Downloaded: 1 files, 25K in 0.1s (202 KB/s)
[root@admin mysql]# ll
total 84
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm.1
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm.2
[root@admin mysql]# yum -y install mysql57-community-release-el7-10.noarch.rpm
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.noarch
Marking mysql57-community-release-el7-10.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-10 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================================================================================
Package                                                              Arch                                              Version                                            Repository                                                                           Size
=====================================================================================================================================================================================================================================================================
Installing:
mysql57-community-release                                            noarch                                            el7-10                                             /mysql57-community-release-el7-10.noarch                                             30 k

Transaction Summary
=====================================================================================================================================================================================================================================================================
Install  1 Package

Total size: 30 k
Installed size: 30 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql57-community-release-el7-10.noarch                                                                                                                                                                                                           1/1
  Verifying  : mysql57-community-release-el7-10.noarch                                                                                                                                                                                                           1/1

Installed:
  mysql57-community-release.noarch 0:el7-10                                                                                                                                                                                                                          

Complete!
[root@admin mysql]# yum -y install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                                                                                                                                                          | 3.6 kB  00:00:00     
epel                                                                                                                                                                                                                                          | 5.3 kB  00:00:00     
extras                                                                                                                                                                                                                                        | 2.9 kB  00:00:00     
mysql-connectors-community                                                                                                                                                                                                                    | 2.5 kB  00:00:00     
mysql-tools-community                                                                                                                                                                                                                         | 2.5 kB  00:00:00     
mysql57-community                                                                                                                                                                                                                             | 2.5 kB  00:00:00     
updates                                                                                                                                                                                                                                       | 2.9 kB  00:00:00     
(1/3): epel/x86_64/updateinfo                                                                                                                                                                                                                 | 1.0 MB  00:00:00     
(2/3): epel/x86_64/primary_db                                                                                                                                                                                                                 | 6.9 MB  00:00:00     
(3/3): mysql57-community/x86_64/primary_db                                                                                                                                                                                                    | 190 kB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.28-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.28-1.el7 for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.28-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.28-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.28-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.28-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================================================================================
Package                                                                Arch                                                   Version                                                       Repository                                                         Size
=====================================================================================================================================================================================================================================================================
Installing:
mysql-community-server                                                 x86_64                                                 5.7.28-1.el7                                                  mysql57-community                                                 199 M
Installing for dependencies:
mysql-community-client                                                 x86_64                                                 5.7.28-1.el7                                                  mysql57-community                                                  43 M
mysql-community-common                                                 x86_64                                                 5.7.28-1.el7                                                  mysql57-community                                                 311 k
mysql-community-libs                                                   x86_64                                                 5.7.28-1.el7                                                  mysql57-community                                                 4.2 M

Transaction Summary
=====================================================================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 247 M
Installed size: 1.0 G
Downloading packages:
(1/4): mysql-community-common-5.7.28-1.el7.x86_64.rpm                                                                                                                                                                                         | 311 kB  00:00:01     
(2/4): mysql-community-libs-5.7.28-1.el7.x86_64.rpm                                                                                                                                                                                           | 4.2 MB  00:00:01     
(3/4): mysql-community-client-5.7.28-1.el7.x86_64.rpm                                                                                                                                                                                         |  43 MB  00:00:07     
(4/4): mysql-community-server-5.7.28-1.el7.x86_64.rpm                                                                                                                                                                                         | 199 MB  00:00:25     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                8.8 MB/s | 247 MB  00:00:28     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.28-1.el7.x86_64                                                                                                                                                                                                        1/4
  Installing : mysql-community-libs-5.7.28-1.el7.x86_64                                                                                                                                                                                                          2/4
  Installing : mysql-community-client-5.7.28-1.el7.x86_64                                                                                                                                                                                                        3/4
  Installing : mysql-community-server-5.7.28-1.el7.x86_64                                                                                                                                                                                                        4/4
  Verifying  : mysql-community-libs-5.7.28-1.el7.x86_64                                                                                                                                                                                                          1/4
  Verifying  : mysql-community-common-5.7.28-1.el7.x86_64                                                                                                                                                                                                        2/4
  Verifying  : mysql-community-client-5.7.28-1.el7.x86_64                                                                                                                                                                                                        3/4
  Verifying  : mysql-community-server-5.7.28-1.el7.x86_64                                                                                                                                                                                                        4/4

Installed:
  mysql-community-server.x86_64 0:5.7.28-1.el7                                                                                                                                                                                                                       

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.28-1.el7                                           mysql-community-common.x86_64 0:5.7.28-1.el7                                           mysql-community-libs.x86_64 0:5.7.28-1.el7                                          

Complete!
[root@admin mysql]# systemctl start  mysqld.service
[root@admin mysql]#  systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-11-08 18:02:33 CST; 7s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 4834 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 4780 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 4837 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─4837 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Nov 08 18:02:26 admin systemd[1]: Starting MySQL Server...
Nov 08 18:02:33 admin systemd[1]: Started MySQL Server.
[root@admin mysql]# grep "password" /var/log/mysqld.log
2019-11-07T07:04:08.060243Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: RZu:EsiK;89A
2019-11-07T07:04:26.285521Z 8 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2019-11-08T10:02:29.848911Z 1 [Note] A temporary password is generated for root@localhost: e3*Ppo9h-:V0
[root@admin mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28

Copyright (c) 2000, 2019, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'aimeelove';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'aimee520';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'aimee_520';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> show variables like 'validate_password%';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aimee_520';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@admin mysql]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      12838/./redis-serve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1022/sshd           
tcp6       0      0 :::3306                 :::*                    LISTEN      4837/mysqld         
[root@admin mysql]# vim /etc/my.cnf
[root@admin mysql]# cat /etc/
Display all 189 possibilities? (y or n)
[root@admin mysql]# cat /etc/
cat: /etc/: Is a directory
[root@admin mysql]# cat /etc/my.cnf
my.cnf    my.cnf.d/
[root@admin mysql]# cat /etc/my.cnf
my.cnf    my.cnf.d/
[root@admin mysql]# cat /etc/my.cnf
my.cnf    my.cnf.d/
[root@admin mysql]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@admin mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@admin mysql]# mysql -version
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@admin mysql]# ll
total 84
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm.1
-rw-r--r-- 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm.2
[root@admin mysql]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@admin mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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> update user set host='%' where user='root';
ERROR 1046 (3D000): No database selected
mysql>
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> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值