MySQL-MariaDB installation

Install the needed software.

apt-get -y install mariadb-server mariadb-client

mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:<your password>
Re-enter new password: <your password>
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

 

Create the needed databases.

mysql -u root -p

create database <Yourdatabase>;

 

Create the needed users for READ and READ/WRITE ACCESS!!:

CREATE USER 'cmwrite'@'localhost' IDENTIFIED BY '<password>';
GRANT SELECT,INSERT,UPDATE,DELETE ON <Database>.* to 'cmwrite'@'localhost';

CREATE USER 'cmread'@'localhost' IDENTIFIED BY '<otherpassword>';
GRANT SELECT ON <Database>.* to 'cmread'@'localhost';

FLUSH PRIVILEGES;

 

Create Tables.

use <databasename>;

CREATE TABLE elecgas (date DATETIME, sdalt BIGINT, spiekt BIGINT, selectotal BIGINT, tdalt BIGINT, tpiekt BIGINT, telectotal BIGINT, swhuidig INT, twhuidig INT, gast BIGINT, diffelec INT, diffgas INT );

show tables;
describe elecgas;

exit;

 

Insert data into the table.

echo "INSERT INTO elecgas VALUES ('$MSDATE','$SDALT','$SPIEKT','$SELECTOTAL','$TDALT','$TPIEKT','$TELECTOTAL','$SWHUIDIG','$TWHUIDIG','$GAST');" | mysql -u root --password=<databasepassword> <Yourdatabase>

 

  Donate now via the Paypal button on the top in US Dollar and on the bottom in Euro