docker
docker run
-itd
-p 3306:3306
--restart always
-e MYSQL_ROOT_PASSWORD=root
-e TZ=Asia/Shanghai
-v ${HOME}/mysql:/var/lib/mysql
--name mysql57
mysql:5.7
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--character-set-client-handshake=FALSE
docker run -it --rm mysql:5.7 mysql -h172.17.0.2 -uroot -proot
win
- [下载mysql-5.7.30-winx64.zip](https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.30-winx64.zip)
https://dev.mysql.com/downloads/mysql/
- 配置文件
my.ini
[mysqld]
default-storage-engine = innodb
innodb_file_per_table = 1
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init-connect = 'SET NAMES utf8mb4'
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir = D:devmysql-5.7.30-winx64
# 设置mysql数据库的数据的存放目录
datadir = D:devmysql-5.7.30-winx64data
# 允许最大连接数
max_connections = 200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server = utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine = INNODB
default-time_zone = '+8:00'
- 安装
添加winpath
mysqld install
mysqld --initialize-insecure --user=mysql
net start mysql
- 改root密码
mysql -uroot -p
set password for root@localhost = password('root');