NoteOnMe博客平台搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 regels
1.6 KiB

<?php
try {
/*$pdo = new PDO('mysql:host=localhost;port=8889;dbname=blog',
'fred', 'zap');*/
$pdo = new PDO('mysql:host=10.23.243.242;port=3306;dbname=blog',
'root', 'a15862340183');
} catch (Exception $e) {
echo($e->getMessage());
}
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*
GRANT ALL ON blog.* TO 'root'@'%' IDENTIFIED BY 'a15862340183';
CREATE DATABASE blog DEFAULT CHARACTER SET utf8;
CREATE TABLE users (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
password VARCHAR(128) NOT NULL ,
name VARCHAR(255) NOT NULL ,
PRIMARY KEY(user_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE article (
article_id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
user_id INT UNSIGNED NOT NULL,
headline TEXT,
content TEXT,
viewer INT UNSIGNED ,
public varchar(11),
category varchar(128),
PRIMARY KEY(article_id),
CONSTRAINT articc_ibfk_1
FOREIGN KEY (user_id)
REFERENCES users (user_id)
ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE commentsss (
id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
comment_id INT UNSIGNED NOT NULL,
feedback_id INT UNSIGNED ,
name VARCHAR(128),
user_id INTEGER,
article_id INT UNSIGNED,
content TEXT,
PRIMARY KEY(id),
CONSTRAINT articcc_ibfk_1
FOREIGN KEY (article_id)
REFERENCES article (article_id)
ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
*/