当前位置:网站首页>【Docker】Docker安装MySQL

【Docker】Docker安装MySQL

2022-08-09 06:46:00 L-DiCaprio

1.docker pull 安装mysql:

docker pull mysql

2.运行mysql容器:

docker run -p 3306:3306 --privileged=true -v /root/mysql/log:/var/log/mysql -v /root/mysql/data:/var/lib/mysql -v /root/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 --name mysql -d mysql:5.7

3.配置mysql配置文件,解决中文乱码:

vi /root/mysql/conf/my.conf
	[client]
	default_character_set=utf8
	[mysql]
	collation_server=utf8_general_ci
	character_set_server=utf8

建库建表插入数据:

create database db01;
use db01;
create table t1(id int,name varchar(20));
insert into t1 values(1,'z3');
原网站

版权声明
本文为[L-DiCaprio]所创,转载请带上原文链接,感谢
https://blog.csdn.net/shroudiwnl/article/details/122511216