1.下载mysql-8.0.25(https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.25-el7-x86_64.tar.gz)
2.安装
[root@hadoop03 mysql]# ll 总用量 752176 -rw-r--r-- 1 root root 770227407 6月 6 13:18 mysql-8.0.25-el7-x86_64.tar.gz [root@hadoop03 mysql]# ll 总用量 752176 -rw-r--r-- 1 root root 770227407 6月 6 13:18 mysql-8.0.25-el7-x86_64.tar.gz [root@hadoop03 mysql]# tar -zxf mysql-8.0.25-el7-x86_64.tar.gz [root@hadoop03 mysql]# ll 总用量 752176 drwxr-xr-x 9 root root 129 6月 6 16:12 mysql-8.0.25-el7-x86_64 -rw-r--r-- 1 root root 770227407 6月 6 13:18 mysql-8.0.25-el7-x86_64.tar.gz [root@hadoop03 mysql]# cd mysql-8.0.25-el7-x86_64 [root@hadoop03 mysql-8.0.25-el7-x86_64]# ll 总用量 284 drwxr-xr-x 2 7161 31415 4096 4月 24 00:12 bin drwxr-xr-x 2 7161 31415 55 4月 24 00:12 docs drwxr-xr-x 3 7161 31415 282 4月 24 00:12 include drwxr-xr-x 6 7161 31415 201 4月 24 00:12 lib -rw-r--r-- 1 7161 31415 274942 4月 23 23:06 LICENSE drwxr-xr-x 4 7161 31415 30 4月 24 00:12 man -rw-r--r-- 1 7161 31415 666 4月 23 23:06 README drwxr-xr-x 28 7161 31415 4096 4月 24 00:12 share drwxr-xr-x 2 7161 31415 77 4月 24 00:12 support-files [root@hadoop03 mysql-8.0.25-el7-x86_64]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/mysql-8.0.25-el7-x86_64 --datadir=/usr/local/mysql/mysql-8.0.25-el7-x86_64/data --pid-file=/usr/local/mysql/mysql-8.0.25-el7-x86_64/data/mysql.pid --explicit_defaults_for_timestamp 2021-06-06T08:13:38.660764Z 0 [System] [MY-013169] [Server] /usr/local/mysql/mysql-8.0.25-el7-x86_64/bin/mysqld (mysqld 8.0.25) initializing of server in progress as process 86001 2021-06-06T08:13:38.681767Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-06-06T08:13:40.754695Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-06-06T08:13:43.717486Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: NXn)yjlwi39* [root@hadoop03 mysql-8.0.25-el7-x86_64]# ./bin/mysqld --user=root & [1] 86166 [root@hadoop03 mysql-8.0.25-el7-x86_64]# 2021-06-06T08:16:05.362284Z 0 [System] [MY-010116] [Server] /usr/local/mysql/mysql-8.0.25-el7-x86_64/bin/mysqld (mysqld 8.0.25) starting as process 86166 2021-06-06T08:16:05.383695Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-06-06T08:16:05.839782Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-06-06T08:16:06.076132Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock 2021-06-06T08:16:06.317006Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2021-06-06T08:16:06.317465Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2021-06-06T08:16:06.367146Z 0 [System] [MY-010931] [Server] /usr/local/mysql/mysql-8.0.25-el7-x86_64/bin/mysqld: ready for connections. Version: '8.0.25' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server - GPL. [root@hadoop03 mysql-8.0.25-el7-x86_64]# ./bin/mysql -uroot -pNXn)yjlwi39* bash: 未预期的符号 `)' 附近有语法错误 [root@hadoop03 mysql-8.0.25-el7-x86_64]# ./bin/mysql -uroot -pNXn\)yjlwi39* 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 8 Server version: 8.0.25 Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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 '123456'; Query OK, 0 rows affected (0.00 sec) mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
3.连接
3.卸载:只需要停止mysql服务,删掉此文件夹即可