In continuation to my previous question here (Fully details: connect Raspberry Pi 4 to a remote MySql database located on a server), I have been digging to find out what causing the error and why my Raspberry Pi 4
fails to connect to a remote MySql
database through JavaScript
but, it makes a perfect connection through Python
script.
I executed the following shelljs.exec()
command to know the cause (inspired from: how to run node shelljs in sync mode and get stdout and stderr) and I got the following output. I need help to know what this error mean and I need to do fix it.
My code and output:
>> var shell = require('shelljs');
>> const { stdout, stderr, code } = shell.exec(command, { silent: true })
>> console.log("Stdout: "+stdout+", Stderr: "+stderr+", Code: "+code)
# Output is
>> Stdout: , Stderr: /bin/sh: 1: mysql: not found, Code: 127
My understanding from above is, there is no output. But there is an error message called /bin/sh: 1: mysql: not found
and error code is 127
. I appreciate your help to understand what this error mean and what I need to do? Does it telling that my Raspberry Pi 4
is missing something, so it fails to connect to the remote MySql
through JavaScript
?
Update:
- Based on @Mark Setchell suggestion below:
I have installed the
MySql
on theRPi
by referring https://pimylifeup.com/raspberry-pi-mysql/ The code issudo apt install mariadb-server
- @Mark Setchell suggestions: Here is the terminal response
pi@raspberrypi:~ $ /usr/bin/mysql -u fieldArduinoYUN -h aa.bb.cc.dd -p abcdf -e "use field_data; SELECT product FROM product_list WHERE product_id = 123;"
Enter password:
ERROR 1044 (42000): Access denied for user 'fieldArduinoYUN'@'%' to database 'abcdf'
pi@raspberrypi:~ $