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

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

内容简介:这篇文章主要介绍了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;


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

查看所有标签

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

Bulletproof Web Design

Bulletproof Web Design

Dan Cederholm / New Riders Press / 28 July, 2005 / $39.99

No matter how visually appealing or packed with content a Web site is, it isn't succeeding if it's not reaching the widest possible audience. Designers who get this guide can be assured their Web site......一起来看看 《Bulletproof Web Design》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

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

HTML 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具