MySQL 5.7.17 for WIN8怎样安装
发布时间:2021-12-21 11:20:23 所属栏目:MySql教程 来源:互联网
导读:这篇文章将为大家详细讲解有关MySQL 5.7.17 for WIN8如何安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。 添加环境变量 右键--我的电脑--属性-- 高级系统设置--环境变量 新建系统变量: 变量名:MYSQL_HOME 变量值:
这篇文章将为大家详细讲解有关MySQL 5.7.17 for WIN8如何安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。 添加环境变量 右键-->我的电脑-->属性--> 高级系统设置-->环境变量 新建系统变量: 变量名:MYSQL_HOME 变量值:D:databasemysql-5.7.17-winx64 再在path末尾中添加 %MYSQL_HOME%bin 例如: D:Python27;C:UsersduansfDesktopvimvim80;%MYSQL_HOME%bin 注册为windows系统服务: 需要在命令提示符(管理员模式)下执行: d:databasemysql-5.7.17-winx64bin>d:databasemysql-5.7.17-winx64binmysqld install MySQL --defaults-file="d:databasemysql-5.7.17-winx64my.ini" Service successfully installed. my.ini内容如下: [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:/database/mysql-5.7.17-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:/database/mysql-5.7.17-winx64/data slow_query_log=TRUE slow_query_log_file=d:/slow_query_log.txt long_query_time=1 # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB # 主从复制参数配置 log_bin = mysql-bin server_id = 1 5.手动启动MySQL服务: d:databasemysql-5.7.17-winx64bin>net start mysql MySQL 服务正在启动 .. MySQL 服务无法启动。 服务没有报告任何错误。 请键入 NET HELPMSG 3534 以获得更多的帮助。 手动启动服务失败,经查看官方资料,解决思路如下: 启动前我们需要使用-initialize初始化Data目录生成并生成随机密码,使用-initialize-insecure可以生成空密码。默认帐号root 此处我们用-initialize-insecure生成空密码 d:databasemysql-5.7.17-winx64bin>mysqld --initialize-insecure d:databasemysql-5.7.17-winx64bin>net start mysql MySQL 服务正在启动 .. MySQL 服务已经启动成功。 用空密码登录: C:Usersduansf>mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 Server version: 5.7.17-log 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> mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> 6.更改root密码: mysql> UPDATE mysql.user SET password=PASSWORD("123456") WHERE user='root'; ERROR 1054 (42S22): Unknown column 'password' in 'field list' mysql> 更改密码报错,因为新版5.7版本的mysql数据库下的user表中已经没有Password字段了,而是将加密后的用户密码存储于authentication_string字段 更改密码命令如下: mysql> update MySQL.user set authentication_string=password('123456') where user='root'; Query OK, 1 row affected, 1 warning (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> mysql> mysql> flush privileges; Query OK, 0 rows affected (0.13 sec) 7.用新密码登录: d:databasemysql-5.7.17-winx64bin>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.17-log 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> 关于“MySQL 5.7.17 for WIN8如何安装”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。 (编辑:临夏站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐