用wget 下載
[root@rosalie-mysql02]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.16-linux-glibc2.12-x86_64.tar
2. 解壓縮
[root@rosalie-mysql02]# tar xvf mysql-8.0.16-linux-glibc2.12-x86_64.tar
mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
mysql-router-8.0.16-linux-glibc2.12-x86_64.tar.xz
mysql-test-8.0.16-linux-glibc2.12-x86_64.tar.xz
再解tar.xz的壓縮
[root@rosalie-mysql02]# tar -xJf mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
3. 移動壓縮包到usr/local目錄下,並重命名文件
[root@rosalie-mysql02]# mv mysql-8.0.16-linux-glibc2.12-x86_64 /usr/local/
4. 創建mysql用戶組和mysql用戶
[root@rosalie-mysql02]# groupadd mysql
[root@rosalie-mysql02]# useradd -g mysql mysql
5. 進行初始化成功後,記得把密碼記住
[root@rosalie-mysql02 bin]# /usr/local/mysql/bin/mysqld --initialize --user=mysql
2019-05-14T09:08:25.271808Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server in progress as process 18517
2019-05-14T09:08:27.891836Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: me>*_PnB*65o
2019-05-14T09:08:28.655548Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server has completed
6. 接著啟動MYSQL
[root@rosalie-mysql02 bin]# service mysql start
. SUCCESS!
##登入成功
[root@rosalie-mysql02 bin]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.16
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>