智能文章系统实战-创建数据库(1)

admin 发布于:2018-6-15 10:38  有 1837 人浏览,获得评论 0 条 标签: mysql 

1.安装MariaDB数据库

#yum install mariadb mariadb-server mariadb-devel  #安装
#systemctl start mariadb #启动服务

 

2.创建数据库article

 

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 379
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE article DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.02 sec)
MariaDB [(none)]> use article;
Database changed
MariaDB [article]> CREATE TCREATE TABLE `article` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文章ID',
  `title` varchar(255) NOT NULL DEFAULT '' COMMENT '文章标题',
  `content` text NOT NULL COMMENT '文章内容',
  `times` int(11) NOT NULL DEFAULT '0' COMMENT '发布时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.05 sec)
MariaDB [article]> select * from article;
Empty set (0.00 sec)

MariaDB [article]> 


 

备注:按照最简单的系统的设计。所以字段未包含 分类,关键词,导语,文章审核状态等字段。