28 lines
756 B
Markdown
28 lines
756 B
Markdown
# dht22 Temperature Stats
|
|
|
|
|
|
## mySQL
|
|
|
|
Login: `mysql --user=root --password=password`
|
|
|
|
Creating new user: `create user 'dhtuser'@'localhost' IDENTIFIED BY 'raspberry';`
|
|
|
|
Permissions: `grant all privileges on *.* to 'dhtuser'@'localhost';`
|
|
|
|
Create database: `create database dhtstats;`
|
|
|
|
Use database: `use dhtstats`
|
|
|
|
Create new table: `CREATE TABLE stats (id MEDIUMINT NOT NULL AUTO_INCREMENT, pin int not null, humidity FLOAT NOT NULL, temperature FLOAT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) );`
|
|
|
|
Show all entries in table: `select * from stats`
|
|
|
|
## Dependencies
|
|
|
|
### Raspberry Pi
|
|
`sudo apt-get install libmysqlclient-dev libmysqld-dev mysql libconfig-dev`
|
|
|
|
### ESP-8266
|
|
[aRest](https://github.com/marcoschwartz/aREST)
|
|
|