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;
