CentOS7バージョンはmysql8.0.12をインストール

1、インストールパッケージMySQLのソースをダウンロードしてインストール

MySQLのソースインストールパッケージのダウンロードリンク

若しくは

[root@ chenc01 ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
[root@ chenc01 ~]# yum localinstall mysql80-community-release-el7-1.noarch.rpm

2、インストールが成功したかどうかをチェック

[root@ chenc01 ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                 141
mysql-tools-community/x86_64      MySQL Tools Community                      105
mysql80-community/x86_64          MySQL 8.0 Community Server                 161

3、MySQLをインストール

[root@ chenc01 ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror
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     
mysql55-community                                                                    | 2.5 kB  00:00:00     
updates                                                                              | 2.9 kB  00:00:00     
mysql55-community/x86_64/primary_db                                                  | 183 kB  00:00:00     
Loading mirror speeds from cached hostfile

4、MySQLのサービスを開始

1)[スタート]

[root@ chenc01 ~]# systemctl start mysqld

2)起動状態を確認します

[root@ chenc01 ~]# systemctl status mysqld
● mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-03-16 18:17:59 CST; 39s ago
  Process: 2003 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 1949 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2002 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ├─2002 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─2161 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/...

3)ブートを設定します

[root@ chenc01 ~]# systemctl enable mysqld
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mysqld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.

4)スタートのMySQL

注MySQL8.0.19のログインパスワードが自動的に生成されます!

[root@ chenc01 ~]# grep 'temporary password' /var/log/mysqld.log
2020-03-16T10:33:27.273294Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: eRxeGx_AO5nZ
[root@ chenc01 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.19

Copyright (c) 2000, 2020, 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> 

5)MySQLのパスワードを変更します

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'TestBicon@123';
Query OK, 0 rows affected (0.01 sec)
mysql> 
公開された60元の記事 ウォン称賛58 ビュー10000 +

おすすめ

転載: blog.csdn.net/chen_jimo_c/article/details/104906414