I use a NodeMCU arduino to send sensor data to MySQL database. I used this code to create my table
CREATE TABLE Sensor (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
value1 VARCHAR(10),
value2 VARCHAR(10),
value3 VARCHAR(10),
reading_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
I also use a php page to store data on database and a second php page to visualise 40 most recent entires
My question is:
change your datatype to BigINT
this should help for the next few years. till they decide to make it finaly 64 bit or even higher is necessary
When AUTO_INCREMENT hits the limit of the datatype it stops inserting with an error message like
Failed to read auto-increment value from storage engine
changing the id is always a bad idea so let it stay and auto_increment doesn't garantee a consequential number. you can always build one yourself look for row_numbw
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.