3、Flask构建弹幕微电影网站-安装mysql数据库及配置

【百度云搜索,搜各种资料:http://www.81ad.cn】

Flask 构建微电影视频网站

已上线演示地址: https://www.akp123.com

安装数据库连接依赖包

安装包flask-sqlalchemy

pip install flask-sqlalchemy

pip list
Package          Version
---------------- -------
Click            7.0
Flask            1.0.2
Flask-SQLAlchemy 2.3.2
itsdangerous     0.24
Jinja2           2.10
MarkupSafe       1.0
pip              18.1
setuptools       40.4.3
SQLAlchemy       1.2.12
Werkzeug         0.14.1
wheel            0.32.1

中文文档

http://www.pythondoc.com/flask-sqlalchemy/index.html

查看配置键: http://www.pythondoc.com/flask-sqlalchemy/config.html#id2

3、Flask构建弹幕微电影网站-安装mysql数据库及配置_第1张图片
BLOG_20181028_122213_58

连接格式

MySQL: mysql://username:password@localhost/mydatabase

创建mysql数据库

下载mysql

https://dev.mysql.com/downloads/mysql/

这儿直接用的最新版8.0

MySQL Community Server

学习使用下载社区版就可以

安装mysql

3、Flask构建弹幕微电影网站-安装mysql数据库及配置_第2张图片
BLOG_20181028_122220_14
3、Flask构建弹幕微电影网站-安装mysql数据库及配置_第3张图片
BLOG_20181028_122240_15
3、Flask构建弹幕微电影网站-安装mysql数据库及配置_第4张图片
BLOG_20181028_122247_66

打开开始菜单的MySQL 8.0 Command Line Client验证是否正常安装

Enter password: root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
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> \s
--------------
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe  Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)

Connection id:          11
Current database:
Current user:           root@localhost
SSL:                    Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter:        ;
Server version:         8.0.12 MySQL Community Server - GPL
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    gbk
Conn.  characterset:    gbk
TCP port:               3306
Uptime:                 2 min 20 sec

Threads: 2  Questions: 23  Slow queries: 0  Opens: 147  Flush tables: 2  Open tables: 123  Queries per second avg: 0.164
--------------

如果cmd中mysql命令不管用,需要添加环境变量,在Path中添加C:\Program Files\MySQL\MySQL Server 8.0\bin\,也就是mysql的安装目录

然后就通过以下命令可以登录了

mysql -uroot -p
Enter password: root

你可能感兴趣的:(3、Flask构建弹幕微电影网站-安装mysql数据库及配置)