1

I would like send some port checking data and a timestamp ( both saved as a variable) to my remote Mysql DB running on a linux Node machine . I don't want install sql or sql client in Pi because the device having enough load already

4
  • You seem to have previously asked a question about transferring files to a remote server. Using the same approach, you could collect your data into a local file first, and then send it across.
    – Haxiel
    Commented Feb 28, 2019 at 15:10
  • maybe rsyslog with MySQL? see opensourceforu.com/2015/10/…
    – Bodo
    Commented Feb 28, 2019 at 15:23
  • Can you ssh from the pi to the database server?
    – pLumo
    Commented Feb 28, 2019 at 15:24
  • If you just want to insert the data into MySQL on your server then you can just install mysql-community-client on your Raspberry Pi. It won't use many resources. That will just provide the mysql command which you can use to connect the mysql on your server after you've allowed remote connections. Another way is to install phpmyadmin on the server and use the web interface to enter data. You can also ssh into the server and input the data that way as previously mentioned. Commented Feb 28, 2019 at 15:46

1 Answer 1

1

If you can ssh to the database server, you can run mysql directly on the server via ssh:

ssh user@dbserver \
  mysql -u USER -p PASSWORD \
    -e "insert into table (data, timestamp) VALUES ('${data}','${timestamp}') " \
    database-name

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .