笔记本装完centos7系统,想要安装 mysql-8.0.19。由于编译安装失败,记录了失败过程之后,开始尝试安装 rpm 文件。 很简单,下面记录安装过程:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
系统 | CentOS Linux release 7.7.1908 |
mysql版本 | mysql-8.0.19-1.el7.x86_64 |
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-i686.tar.xz
# groupadd mysql
# useradd -g mysql -s /sbin/nologin -d /usr/local/mysql -MN mysql
# mkdir /usr/local/mysql
# mv 下载/mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar /usr/local/mysql/
# cd /usr/local/mysql
# tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.19-1.el7.x86_64.rpm
mysql-community-server-8.0.19-1.el7.x86_64.rpm
mysql-community-test-8.0.19-1.el7.x86_64.rpm
mysql-community-common-8.0.19-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.19-1.el7.x86_64.rpm
mysql-community-devel-8.0.19-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.19-1.el7.x86_64.rpm
mysql-community-libs-8.0.19-1.el7.x86_64.rpm
# rpm -ivh --nodeps --force mysql-community-common-8.0.19-1.el7.x86_64.rpm
# rpm -ivh --nodeps --force mysql-community-libs-8.0.19-1.el7.x86_64.rpm
# rpm -ivh --nodeps --force mysql-community-client-8.0.19-1.el7.x86_64.rpm
# rpm -ivh --nodeps --force mysql-community-server-8.0.19-1.el7.x86_64.rpm
# rpm -qa | grep mysql
mysql-community-libs-8.0.19-1.el7.x86_64
mysql-community-common-8.0.19-1.el7.x86_64
mysql-community-server-8.0.19-1.el7.x86_64
mysql-community-client-8.0.19-1.el7.x86_64
# mysqld --initialize
# chown mysql:mysql /var/lib/mysql -R
# systemctl start mysqld.service
# systemctl status mysqld.service
# systemctl enable mysqld
# cat /var/log/mysqld.log | grep password
2020-03-24T06:10:15.034575Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: OuVtlR8GJP!5
# mysql -uroot -p
Enter password: <--- 这里粘贴刚才复制的密码
mysql> alter user 'root' @'localhost' identified with mysql_native_password by '你的密码';
mysql> exit
Bye
# mysql -u root -p
Enter password: <--- 输入你的新密码
mysql> create user 'root'@'%' identified by '密码';
Query OK, 0 rows affected (0.02 sec)
mysql> grant all privileges on *.* to 'root'@'%';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> alter user 'root' @'%' identified with mysql_native_password by '密码';
Query OK, 0 rows affected (0.01 sec)
# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.19 MySQL Community Server - GPL
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>