mysql5.7免安装版配置(window)
程序员文章站
2022-05-01 18:17:55
...
软件下载及安装
https://downloads.mysql.com/archives/community/
1. 解压文件
2. 创建data目录
执行命令:mysqld --initialize-insecure --user=mysql
E:\software\MySQL\mysql-5.7.17-winx64\bin>mysqld --initialize-insecure --user=mysql
3. 配置my.ini
复制一份my-default.ini改名为my.ini
[mysql]
#设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置端口
port=3306
# 设置mysql的安装目录
basedir=E:/software/MySQL/mysql-5.7.17-winx64
# 设置mysql数据库的数据的存放目录
datadir=E:/software/MySQL/mysql-5.7.17-winx64/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
4. 安装服务
执行命令:mysqld install MySQL57_3307 --defaults-file=""
E:\software\MySQL\mysql-5.7.17-winx64\bin>mysqld install MySQL57 --defaults-file="E:\software\MySQL\mysql-5.7.17-winx64\my.ini"
5. 启动服务
执行命令:net start MySQL57
E:\software\MySQL\mysql-5.7.17-winx64\bin>net start MySQL57
6. 修改密码
默认密码可以通过根目录data文件夹下.err文件中找到。本例mysql版本为5.7.17默认密码为空。
7. 修改默认密码
执行命令:mysql -u root -p
执行sql set password = 'root'
E:\software\MySQL\mysql-5.7.17-winx64\bin>mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> set password = 'root';