第二十六章 Centos7下Docker安装Mariadb
2022/1/15 7:36:17
本文主要是介绍第二十六章 Centos7下Docker安装Mariadb,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、查找Mariadb镜像
[root@staging ~]# docker search mariadb:10.0.26
二、拉取Mariadb镜像
[root@staging ~]# docker pull mariadb:10.0.26
三、运行Mariadb
[root@staging ~]# docker run \ -itd \ -p 13306:3306 \ -v /data2/mariadb/conf:/etc/mysql/conf.d \ -v /data2/mariadb/data:/var/lib/mysql \ -v /data2/mariadb/log:/var/log/mysql \ -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \ -e MYSQL_ROOT_PASSWORD=123456 \ --restart always \ --privileged=true \ --name mariadb \ mariadb:10.0.26
四、验证Mariadb容器
[root@staging data2]# docker ps |grep mariadb 8f71d895b3f1 mariadb:10.0.26 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:13306->3306/tcp, :::13306->3306/tcp
五、配置Mariadb
[root@staging ~]# cd /data2/mariadb/conf/
[root@staging conf]# cat client.cnf # # These two groups are read by the client library # Use it for options that affect all clients, but not the server # [client] # This group is not read by mysql client library, # If you use the same .cnf file for MySQL and MariaDB, # use it for MariaDB-only client options [client-mariadb]
[root@staging conf]# cat mysql-clients.cnf # # These groups are read by MariaDB command-line tools # Use it for options that affect only one utility # [mysql] [mysql_upgrade] [mysqladmin] [mysqlbinlog] [mysqlcheck] [mysqldump] [mysqlimport] [mysqlshow] [mysqlslap
[root@staging conf]# cat tokudb.cnf [mariadb] # See https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/ # for instructions how to enable TokuDB # # See https://mariadb.com/kb/en/tokudb-differences/ for differences # between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/ #plugin-load-add=ha_tokudb.so
[root@staging conf]# cat server.cnf # # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock character_set_server=utf8 slow_query_log=on slow_query_log_file=/var/log/mysql/slow_query_log.log long_query_time=2 explicit_defaults_for_timestamp = 1 innodb_large_prefix=on max_connections=3000 innodb_file_format = BARRACUDA # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] # This group is only read by MariaDB-10.0 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.0]
六、重启Mariadb
#1.重启MySQL [root@staging conf]# docker restart mariadb mariadb #2.查看MySQL日志,发现MySQL正常启动,日志时间也与系统时间保持一致 [root@staging ~]# docker logs -f mariadb 220112 15:01:55 [Note] Server socket created on IP: '::'. 220112 15:01:55 [Warning] 'proxies_priv' entry '@% root@cf6ad44a4433' ignored in --skip-name-resolve mode. 220112 15:01:55 [Note] mysqld: ready for connections. Version: '10.0.26-MariaDB-1~jessie' socket: '/var/lib/mysql/mysql.sock' port: 3306 mariadb.org binary distribution
这篇关于第二十六章 Centos7下Docker安装Mariadb的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-14Docker端口:你真的公开了哪些东西?
- 2024-11-14用DOCKER在家里的实验室里搞些酷炫的玩意儿
- 2024-11-05掌握Docker:高效安全的十大最佳实践
- 2024-11-05在 Docker Compose 中怎么设置端口映射-icode9专业技术文章分享
- 2024-11-05在 Docker Compose 中怎么设置环境变量-icode9专业技术文章分享
- 2024-11-04Docker环境部署项目实战:新手入门教程
- 2024-11-04Docker环境部署资料:新手入门教程
- 2024-11-01Docker环境部署教程:新手入门指南
- 2024-11-01超越Docker:苹果芯片上的模拟、编排和虚拟化方案讲解
- 2024-11-01Docker环境部署:新手入门教程