Python3.7和数据库MySQL 8.0.12 绿色解压 安装教程(一)

首先要安装MySQL 数据库才可以继续安装图形工具SQLyog

第一步:下载解压包》》

MYSQL官网地址:https://dev.mysql.com/downloads/file/?id=479669

绿色安装 直接解压即可。

第二步》》环境变量配置

解压之后放入E盘,需在系统进行环境变量配置

 ==============================================================================

第三步》》mysql初始化配置

接下来连接和启动数据库操作:

3.1  创建初始化配置my.ini配置文件 存放根目录下面  复制下面文档(需修改路径)

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=E:\mysql\mysql-8.0.12-winx64   # 切记此处一定要用双斜杠\,单斜杠我这里会出错。
# 设置mysql数据库的数据的存放目录
datadir=E:\mysql\mysql-8.0.12-winx64\Data   # 此处同上
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

3.2 在c:Windowssystem32 找到cmd.exe 右键以系统管理员身份启动该程序 

指令路径切换到bin目录下输入指令:

//生成临时密码

mysqld --initialize --console       

示例:

E:mysqlmysql-8.0.12-winx64in>mysqld --initialize --console
2018-09-03T03:05:19.275614Z 0 [System] [MY-013169] [Server] E:mysqlmysql-8.0.12-winx64inmysqld.exe (mysqld 8.0.12) initializing of server in progress as process 7608
2018-09-03T03:05:37.017614Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: oZig3fdGSh<E
2018-09-03T03:05:50.090414Z 0 [System] [MY-013170] [Server] E:mysqlmysql-8.0.12-winx64inmysqld.exe (mysqld 8.0.12) initializing of server has completed
oZig3fdGSh<E  为系统随机生成的临时密码 

3.3 安装mysql 服务

mysqld --install

示例:

E:mysqlmysql-8.0.12-winx64in>mysqld --install
Service successfully installed.

3.4 启动mysql服务

net start mysql

示例:

E:mysqlmysql-8.0.12-winx64in>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

3.5 进入mysql  输入以下指令之后 需要输入临时密码

mysql -u root -p

示例:

E:mysqlmysql-8.0.12-winx64in>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 8
Server version: 8.0.12

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>

3.6 修改临时密码

修改密码为root

alter user user() identified by "root";

示例:

mysql> alter user user() identified by "root";
Query OK,0 rows affected (0.25 sec)

修改完密码 退出数据库操作

mysql> exit
Bye

3.7 验证密码

E:mysqlmysql-8.0.12-winx64in>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 10
Server version: 8.0.12 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>

ok mysql安装完成了密码也修改成功了      命令行操作麻烦,推荐使用图形化工具SQLyog。

原文地址:https://www.cnblogs.com/dangzhengtao/p/9565766.html