mac M1芯片 centos7虚拟机安装mysql8.0

目前 mysql arm架构的Linux安装包 仅支持 mysql8,没有更早版本

mac M1芯片 centos7虚拟机安装mysql8.0_第1张图片

mac终端运行命令,上传tar包

scp /Users/yun/Desktop/mysql-8.0.28-1.el7.aarch64.rpm-bundle.tar [email protected]:/root

Linux虚拟机创建解压目录

mkdir -p /usr/local/mysql

解压tar包

tar -xvf mysql-8.0.28-1.el7.aarch64.rpm-bundle.tar  -C /usr/local/mysql

安装mysql

  查询当前系统中安装的名称带mariadb的软件

rpm -qa | grep mariadb   

卸载 mariadb,具体指令为:

rpm -e --nodeps mariadb-libs-5.5.68-1.el7.aarch64
 
  

顺序

1

rpm -ivh mysql-community-common-8.0.28-1.el7.aarch64.rpm

2

rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.aarch64.rpm

3

rpm -ivh mysql-community-libs-8.0.28-1.el7.aarch64.rpm

4

rpm -ivh mysql-community-libs-compat-8.0.28-1.el7.aarch64.rpm

5

rpm -ivh mysql-community-client-8.0.28-1.el7.aarch64.rpm

6

rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.aarch64.rpm

7

rpm -ivh mysql-community-embedded-compat-8.0.28-1.el7.aarch64.rpm

       yum install openssl-devel -y

9

rpm -ivh mysql-community-devel-8.0.28-1.el7.aarch64.rpm   

10

       yum install net-tools -y

11

yum install perl-Data-Dumper -y    
yum install perl-JSON -y   
yum install perl-Test-Simple -y

12

rpm -ivh mysql-community-server-8.0.28-1.el7.aarch64.rpm

13

rpm -ivh mysql-community-test-8.0.28-1.el7.aarch64.rpm

启动MySQL服务

systemctl start mysqld.service
systemctl stop mysqld.service
systemctl status mysqld.service
systemctl restart mysqld.service

查询自动生成的root用户密码

grep 'temporary password' /var/log/mysqld.log

命令行执行指令 :

mysql -u root -p

然后输入上述查询到的自动生成的密码, 完成登录 .

修改root用户密码

登录到MySQL之后,需要将自动生成的不便记忆的密码修改了,修改成自己熟悉的便于记忆的密码。

ALTER  USER  'root'@'localhost'  IDENTIFIED BY '1234';

执行上述的SQL会报错,原因是因为设置的密码太简单,密码复杂度不够。

设置密码的复杂度为简单类型,密码长度为4。

set global validate_password.policy = 0;
set global validate_password.length = 4;

降低密码的校验规则之后,再次执行上述修改密码的指令。

ALTER  USER  'root'@'localhost'  IDENTIFIED BY '1234';

创建用户

默认的root用户只能当前节点localhost访问,是无法远程访问的,我们还需要创建一个root账户,用户远程访问

create user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1234';

并给root用户分配权限

grant all on *.* to 'root'@'%';

11. 重新连接MySQL

mysql -u root -p

然后输入密码

你可能感兴趣的:(linux,运维,服务器,java)