温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

树莓派4B如何使用docker安装mysql5.7.30

发布时间:2021-11-12 10:17:17 来源:亿速云 阅读:466 作者:小新 栏目:互联网科技

这篇文章主要介绍了树莓派4B如何使用docker安装mysql5.7.30,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

硬件:Raspberry Pi 4B(4g或8g版本)
系统:Ubuntu 20.04 LTS Docker:18.09.9
mysql镜像:biarms/mysql:5.7.30-linux-arm64v8

  • 注意:因为我们树莓派4B本身并非x86,而是arm架构,且我们的系统装的是64位ubuntu,因此镜像只能选择arm64v8架构的镜像。

配置文件:/home/docker/server/mysql/my.cnf

[mysqld] ##  server_id=1 ##  binlog-ignore-db=mysql ##  log-bin=replicas-mysql-bin ##  binlog_cache_size=1M ##  binlog_format=mixed ##  expire_logs_days=7 max_allowed_packet=125M max_connections=200 max_connect_errors=10000 datadir =/opt/mysql/data socket  =/opt/mysql/data/mysql.sock   #Encoding collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8   log_error=error.log   [client] # default-character-set = utf8 socket  =/opt/mysql/data/mysql.sock

数据目录:/home/docker/server/mysql/data

  • 启动mysql

docker run -itd --name mysqld -p 3306:3306 --restart always --privileged=true -e TZ=Asia/Shanghai -e MYSQL_ROOT_PASSWORD=example -v /home/docker/server/mysql/my.cnf:/etc/mysql/my.cnf -v /home/docker/server/mysql/data:/var/lib/mysql biarms/mysql:5.7.30-linux-arm64v8
  • 访问mysql

# mysql的root用户密码为example docker exec -it mysqld mysql -uroot -pexample 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 3 Server version: 5.7.30-0ubuntu0.18.04.1-log (Ubuntu) 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> status -------------- mysql  Ver 14.14 Distrib 5.7.30, for Linux (aarch74) using  EditLine wrapper Connection id:	3 Current database: Current user:	root@localhost SSL:	Not in use Current pager:	stdout Using outfile:	'' Using delimiter:	; Server version:	5.7.30-0ubuntu0.18.04.1-log (Ubuntu) Protocol version:	10 Connection:	Localhost via UNIX socket Server characterset:	utf8 Db     characterset:	utf8 Client characterset:	latin1 Conn.  characterset:	latin1 UNIX socket:	/opt/mysql/data/mysql.sock Uptime:	2 hours 22 min 33 sec Threads: 1  Questions: 10  Slow queries: 0  Opens: 108  Flush tables: 1  Open tables: 101  Queries per second avg: 0.001

感谢你能够认真阅读完这篇文章,希望小编分享的“树莓派4B如何使用docker安装mysql5.7.30”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI