您好,登錄后才能下訂單哦!
這篇文章主要介紹了樹莓派4B如何使用docker安裝mysql5.7.30,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
硬件:Raspberry Pi 4B(4g或8g版本)
系統(tǒng):Ubuntu 20.04 LTS Docker:18.09.9
mysql鏡像:biarms/mysql:5.7.30-linux-arm64v8
注意:因為我們樹莓派4B本身并非x86,而是arm架構(gòu),且我們的系統(tǒng)裝的是64位ubuntu,因此鏡像只能選擇arm64v8架構(gòu)的鏡像。
配置文件:/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
數(shù)據(jù)目錄:/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”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。