window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解

栏目: 数据库 · Mysql · 发布时间: 7年前

内容简介:这篇文章主要介绍了window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解,需要的朋友可以参考下

1.从官网下载mysql-5.7.21-windowx64.zip mysql下载页面

2.解压到合适的位置(E:\mysql) 这名字是我改过的

3.配置环境变量,将E:\mysql\bin 添加到PATH中

4.在 mysql 目录下(E:\mysql) 创建 my.ini文件,内容如下:

[mysql]  
# 设置mysql客户端默认字符集  
default-character-set=utf8  
[mysqld]  
#设置3306端口  
port = 3306  
# 设置mysql的安装目录  
basedir=E:\mysql
# 设置mysql数据库的数据的存放目录  
datadir=E:\mysql\data
# 允许最大连接数  
max_connections=200  
# 服务端使用的字符集默认为8比特编码的latin1字符集  
character-set-server=utf8  
# 创建新表时将使用的默认存储引擎  
default-storage-engine=INNODB  
"#"为注释

5.管理员身份运行cmd

切换目录 cd E:\mysql\bin

生成mysql服务(就是安装my.ini文件)

E:\mysql\bin> mysqld -install;
Service successfully installed.

生成data目录  E:\mysql\bin> mysqld --initialize-insecure --user=mysql ;

这里生成失败的话看下面

E:\mysql\bin>cd ../
E:\mysql> mysqld --initialize-insecure --user=mysql ; 

启动mysql服务

E:\mysql\bin> net start mysql;

MySQL 服务正在启动 . 

MySQL 服务已经启动成功。

6.登录数据库,修改密码(默认为空)

E:\mysql\bin> mysql -u root -p;
Enter password: //这里直接回车
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 2 
Server version: 5.7.21 MySQL Community Server (GPL) 
Copyright (c) 2000, 2018, 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> use mysql; 
Database changed 
mysql> set password for 'root'@'localhost'=password('新密码');
mysql> flush privileges;

退出测试是否成功

mysql> quit;
E:\mysql\bin> mysql -u root -p;
Enter password:

注释:

在mysql中一条语句结束加;号

开始mysql服务net start mysql;
停止mysql服务net stop mysql;
生成服务mysqld -install;
删除服务mysqld -remove;
登录数据库mysql -u root -p;
退出mysql> quit;


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

微信小程序

微信小程序

牛建兵 / 清华大学出版社 / 2017-9-1 / 49.00

微信小程序从满城风雨到掀起创业热潮,再到一直不断地迭代更新,其每一次更新都会增加新能力,让使用变得越来越方便,同时也增加一批进军小程序的队伍。微信小程序作为现在互联网中的热点,它给创业者、投资者、程序员带来了福音。对创业者来说,小程序能大大降低他们的创业成本,同时也降低了投资者的投资风险。 本书注重实战,通过具体的案例分析,讲解微信小程序的市场状况、人员分工、小程序需求设计、小程序体验设计、......一起来看看 《微信小程序》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具