Django默认使用的数据库是Python自带的SQLite3,SQLite3数据库并不适用于大型的项目。除此之外,Django还支持以下几种数据库:
PostgerSQL(www.postgresql.org/)
MySQL(http:/www.mysql.com/)
Oracle(www.oracle.com)
安装MySQL
MySQL下载地址:http://dev.mysql.com/downloads/m…。
根据提示进行安装。
当MySQL安装完成后,在Windows命令提示符下进入MySQL。
> mysql -u root -p
Enter password:*****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Sever version: 5.5.20-log MySQL Community Server (GPL)
Copyright (c) 2000,2011, Oracle and/or its affiliates.All rights reserved.
Oracle is a registered trandemark 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基本操作
查看当前库与表
mysql> show databases; #查看当前数据库下面的所有库
+--------------------+
| Datebase |
+--------------------+
| information_schema |
| mysql |
|performance_schema |
| test |
+-------------------+
4 rows in set (0.00 sec)
mysql> use test; #切换到test库
Database changed
mysql> show tables; # 查看当前test库下面的表
Empty set (0.00 sec)
查看MySQL端口号
mysql> show global variables like 'port';
+------------------------+
| Variable_name | Value |
+------------------------+
|port | 3306 |
+------------------------+
1 row in set (0.00 sec)
创建数据库。
mysql> CREATE DATABASE guest CHARACTER SET utf8;
Query OK,1 row affected (0.00 sec)
创建guest库,用于我们开发的发布会签到项目。
搜索微信公众号:TestingStudio霍格沃兹的干货都很硬核