windows 10 系统 安装 MySQL5.7.25

1. 将压缩包解压:mysql-5.7.25-winx64.zip
     E:\Program Files\Navicat\MySQL5.7\mysql-5.7.25-winx64
    2.新建my.ini文件在解压目录下 如1.
        内容:
            [mysqld]
            # 设置3306端口
            port = 3306
            # 设置mysql的安装目录
            basedir=E:\\Program Files\\Navicat\\MySQL5.7\\mysql-5.7.25-winx64
            # 允许最大连接数
            max_connections=200
            # 服务端使用的字符集默认为8比特编码的latin1字符集
            character-set-server=utf8
            # 创建新表时将使用的默认存储引擎
            default-storage-engine=INNODB
            innodb_buffer_pool_size=128M
            # 设置mysql数据库的数据的存放目录
            datadir=E:\\Program Files\\Navicat\\MySQL5.7\\mysql-5.7.25-winx64\\data
            # 错误日志
            log-error=E:\\Program Files\\Navicat\\MySQL5.7\\mysql-5.7.25-winx64\\err.log
            # 编码
            collation-server=utf8_general_ci
            # 查询时长
            long_query_time=2
            [client]
            default-character-set=utf8
    3.配置环境变量
        用户变量
            MYSQL_HOME  :  E:\Program Files\Navicat\MySQL5.7\mysql-5.7.25-winx64
        统变量
            Path 后追加 %MYSQL_HOME%\bin  


CMD命令行:    
4. 窗口左下角搜索框打开  cmd  右键以管理员身份运行
如下显示:
Microsoft Windows [版本 10.0.17763.168]
(c) 2018 Microsoft Corporation。保留所有权利。
#1.
C:\windows\system32>cd E:\Program Files\Navicat\MySQL5.7\mysql-5.7.25-winx64\bin
#错误测试一下
C:\windows\system32>cd E:
E:\Program Files\Navicat\MySQL5.7\mysql-5.7.25-winx64\bin

#2.输入命令
C:\windows\system32>mysqld --initialize --console
2019-04-12T20:10:38.447004Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-12T20:10:38.515839Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2019-04-12T20:10:38.516589Z 0 [ERROR] Aborting
####: 错误原因之前已经执行过一次成功,创建了data文件夹 ,结束进程,删除上次执行生成的文件夹。
#3.再次执行
C:\windows\system32>mysqld --initialize --console
2019-04-12T20:12:43.021087Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-12T20:12:44.593301Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-04-12T20:12:45.101179Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-04-12T20:12:45.242313Z 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: 55b07608-5d5f-11e9-9a4f-b025aa2d2ca4.
2019-04-12T20:12:45.281445Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-04-12T20:12:45.299791Z 1 [Note] A temporary password is generated for root@localhost: UaG2#MaFkp?w  ## 临时密码
#4.启动mysql
C:\windows\system32>net start mysql
服务名无效。

请键入 NET HELPMSG 2185 以获得更多的帮助。

#5.从新切换回来 到C:
C:\windows\system32>C:
###:因不在盘符下 所以键入命令未反应
C:\windows\system32>mysqld instal
#6.再次切换到E:
C:\windows\system32>cd E:\Program Files\Navicat\MySQL5.7\mysql-5.7.25-winx64
#7.输入命令
C:\windows\system32>mysqld install
Service successfully installed.
##:安装成功
#8.输入命令
C:\windows\system32>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

#9.命令行登录数据库
C:\windows\system32>mysql -u root -p
Enter password: ************ ###:此处输入的是上面生成的临时密码 A temporary password is generated for root@localhost: UaG2#MaFkp?w
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25

Copyright (c) 2000, 2019, 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>

#10.修改密码
mysql> set password=password('root')
    -> ;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

### 完成!!!!使用客户端连接  127.0.0.1 \ 3306 \ root \root 

如有问题欢迎评论区!!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值