2017年10月17日星期二

Setup DB for DeadDrop Project


You can make sure if your mysql is correctly installed by running Chris's Node seminar's mysql project and try putting your name on there.

In the deaddrop project directory, open config/db.json
change the "user" and "password" to match your local settings
(you can view the db.json in the seminar's mysql project as reference)

Login to mysql in the terminal

/usr/local/mysql/bin/mysql --user root -p
in the deaddrop repo, open MySQL DB Setup Script.sql

paste the first line to create database
CREATE DATABASE `deaddrop` /*!40100 DEFAULT CHARACTER SET utf8 */;

In terminal, type this to change the database
use deaddrop
then paste the rest to create table

CREATE TABLE `messages` (
`uuid` int(11) NOT NULL AUTO_INCREMENT,
`message` varchar(300) NOT NULL,
`timestamp` datetime NOT NULL,
`latitude` decimal(13,10) NOT NULL,
`longitude` decimal(13,10) NOT NULL,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;


Grant user semdemo to use this db
grant all privileges on deaddrop . * to 'semdemo'@'localhost';

run this in the deaddrop repo
sudo npm start dev
and the website will be at localhost:443







you can see what's in your database right now with
use deaddrop; select * from messages; 

insert message manually (for testing)
insert into messages (message,timestamp,latitude,longitude) values('test message','2007-09-02 00:00:00',47.567,-123.273); 

没有评论:

发表评论