mysql redis插件_docker下安装mysql、redis、php的redis扩展

使用docker-compose安装

编辑添加docker-compose.yml

mysql:

image: mysql:5.7

container_name: mysqld

ports:

- 3306:3306

volumes:

- /Users/longmore/docker/mysql/conf:/etc/mysql/conf.d

- /Users/longmore/docker/mysql/data:/var/lib/mysql

environment:

- MYSQL_ROOT_PASSWORD=123456

networks:

mywebnet2:

ipv4_address: 192.138.0.4

redis:

image: redis:alpine

container_name: redis

ports:

- 7480:6379

volumes:

- /Users/longmore/docker/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf

- /Users/longmore/docker/redis/redisdata:/data

networks:

mywebnet2:

ipv4_address: 192.138.0.11

mysql conf文件夹下建立my.cnf

```

[mysqld]

server-id = 1 #服务Id唯一

port = 3306

log-error = /var/log/mysql/error.log

只能用IP地址

skip_name_resolve

数据库默认字符集

character-set-server = utf8mb4

数据库字符集对应一些排序等规则

collation-server = utf8mb4_general_ci

设置client连接mysql时的字符集,防止乱码

你可能感兴趣的:(mysql,redis插件)