搜索
简帛阁>技术文章>aarch64服务器-部署mysql

aarch64服务器-部署mysql

aarch64服务器-部署mysql

aarch64服务器-部署nacos

1、创建工作目录

mkdir -p /apps/mysql/{mydir,datadir,conf,source}

2、编写docker-compose.yaml

version: '3'
services:
  mysql:
    restart: always
    image: mysql/mysql-server
    container_name: mysql-lable
    volumes:
      - /apps/mysql/mydir:/mydir
      - /apps/mysql/datadir:/var/lib/mysql
      - /apps/mysql/conf/my.cnf:/etc/my.cnf
      # 数据库还原目录 可将需要还原的sql文件放在这里
      - /apps/mysql/source:/docker-entrypoint-initdb.d
    environment:
      - "MYSQL_ROOT_PASSWORD=xxx"
      - "MYSQL_DATABASE=xxx"
      - "TZ=Asia/Shanghai"
    ports:
      # 使用宿主机的3306端口映射到容器的3306端口
      # 宿主机:容器
      - 3307:3306
所在服务器
192.168.2.241   
root@minio-3:~/mysql-8.0# ls
docker-compose.yaml
root@minio-3:~/mysql-8.0# pwd
/root/mysql-8.0

3、编写数据库配置文件。

/apps/mysql/conf/my.cnf

[mysqld]
user=mysql
default-storage-engine=INNODB
character-set-server=utf8
character-set-client-handshake=FALSE
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

4、启动

启动容器的时候,需要先检查所使用的端口是否被占用。

$ docker-compose up -d
$ docker-compose ps
Name                 Command             State           Ports
--------------------------------------------------------------------------
mysql-lable   docker-entrypoint.sh mysqld   Up      0.0.0.0:3306->3306/tcp

image-20220915112712741

5、测试

进入容器,使用密码登录数据库,并查看数据库有没有创建所指定的库,库里面有没有导入你的sql数据

### docker exec -it 容器ID(使用docker ps查看) /bin/bash
$ docker exec -it e592ac9bfa70 /bin/bash
# root@e592ac9bfa70:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31451
Server version: 5.7.18 MySQL Community Server (GPL)

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

# 查看数据
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql_data_test    |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> use mysql_data_test  #这个是我自己的恢复数据文件
mysql> show tables;
.......

记录报错

连接报错

Host is not allowed to connect to this MySQL server解决方法
https://blog.csdn.net/bingjianit/article/details/54384299 #解决文章
在装有MySQL的机器上登录MySQL mysql -u root -p密码
执行use mysql;
执行update user set host = '%' where user = 'root';这一句执行完可能会报错,不用管它。
执行FLUSH PRIVILEGES;

创建用户授权用户,修改root密码

mysqladmin -uroot -p'123456'  password 'xxxx'

一. 创建用户

命令:

CREATE USER 'username'@'host' IDENTIFIED BY 'password';


例子:
CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456';
CREATE USER 'pig'@'192.168.1.101_' IDENDIFIED BY '123456';
CREATE USER 'pig'@'%' IDENTIFIED BY '123456';
CREATE USER 'pig'@'%' IDENTIFIED BY '';
CREATE USER 'pig'@'%';

二. 授权:

命令:

GRANT privileges ON databasename.tablename TO 'username'@'host' 


例子:

GRANT SELECT, INSERT ON test.user TO 'pig'@'%';
GRANT ALL ON *.* TO 'pig'@'%';

二. 授权:

命令:

GRANT privileges ON databasename.tablename TO ‘username’@‘host’

例子:

GRANT SELECT, INSERT ON test.user TO ‘pig’@‘%’;
GRANT ALL ON . TO ‘pig’@‘%’;

目录aarch64服务器部署mysql1、创建工作目录2、编写dockercomposeyaml3、编写数据库配置文件。4、启动5、测试一创建用户二授权:三授权:aarch64服务器部署mysqla
下载https://golanggooglecn/dl/下载这个二进制包go1175linuxarm64targz这才是64位的把go解压到/usr/local/目录下tarzxfgo1175linu
x86_64就是我们常用的台式机的体系架构,是基于冯诺依曼体系架构的。x86_64Linux可以理解为在普通台式机上安装的Linux操作系统。AArch64是一种ARMv8架构,也是一种计算机的体系架
议直接考虑docker方案,目前官方的mysqlserverdocker支持arm64,注意只有mysql8支持,也就是latest标签的这个和在x86下最常用的mysql镜像有点区别,简单翻译一下
MNN是一个非常实用的深度学习推理框架,今天在华为笔记本ubuntu1804上进行MNN的交叉编译,并在nvidiajeston进行部署(没有其他扳子可以用)1、硬件配置jeston的配置如下:2、环
[root@localhostcloud_images]guestfishrwavhusertest1qcow2guestfish:cannotmixroandrwoptions[root@local
构建失败从ubuntu中尝试构建FROMpython:35slimLABELMAINTAINERlifei@plantdatacninstallrelatedpackagesENVENVIRONMEN
更新yum发现总是报错Couldnotretrievemirrorlisthttp://mirrorlistcentosorg/?release7&archx86_64&repoos&infrasto
目录1获取构建mysql镜像的脚本2预先下载gosuarm64、gosuarm64asc,并放到mysql/80目录下3修改Dockerfileoracle,使用本地下载的gosu4执行构建Docke
近工作比较繁忙,因此论坛尽管几乎每天都登录一次,不过回贴、发帖都比较少~在除夕之前,想写点东西给各位参考,呵呵~最近在制作iOS版的CPUDasher64,针对64位ARMv8架构。ARMv8架构与