mysql 解压版 安装步骤详情,本人亲测
程序员文章站
2024-03-17 20:22:04
...
1.下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.26-winx64.zip
2.在解压目录中添加 data文件夹 和 my.ini文件
结构如下:如果没data 请不要手动去创建!请手动创建my.ini
3.在my.ini中配置
[client]
port=3306
default-character-set=utf8
[mysqld]
# 设置mysql的安装目录
basedir=D:/mysql/mysql-5.7.26-winx64
# 设置mysql的数据目录
datadir=D:/mysql/mysql-5.7.26-winx64/data
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 开启查询缓存
explicit_defaults_for_timestamp=true
skip-grant-tables
4.配置环境变量
- 新建MYSQL_HOME变量,并配置值为: D:\mysql\mysql-5.7.26-winx64
- 编辑path系统变量,将%MYSQL_HOME%\bin添加到path变量后。配置path环境变量,也可不新建MYSQL_HOME变量,而是直接将MySQL安装目录下的bin配置到path变量下,Path:%MYSQL_HOME%\bin
5.以管理员身份打开dos命令行窗口(必须管理员),执行
D:\mysql\mysql-5.7.26-winx64\bin>mysqld -install
Service successfully installed.
这一步一定要记好你的初始密码!
D:\mysql\mysql-5.7.26-winx64\bin>mysqld --initialize --user=root --console
2017-12-20T08:13:45.264865Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-12-20T08:13:45.854579Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-12-20T08:13:45.998772Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-12-20T08:13:46.098118Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9755c3ea-a6f1-11e5-81a3-74d02b122fb3.
2017-12-20T08:13:46.121617Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-12-20T08:13:46.135153Z 1 [Note] A temporary password is generated for aaa@qq.com: g!gRw!d%M0Sj
初始化了以后,可以看到MySQL目录下,多了data目录5)D:\mysql\mysql-5.7.26-winx64\bin>net start mysql
D:\Service\mysql57\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26
Copyright (c) 2000, 2017, 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 for 用户名@localhost = password(‘新密码');
例子:mysql> set password for [email protected] = password(‘123');