Re: From bash script (Debian Bookworm) login and query to MariaDB

^Bart <[email protected]> Thu, 2 Nov 2023 11:46:57 +0100
Newsgroups comp.databases.mysql
Organization A noiseless patient Spider
Message-ID <[email protected]>
> Thanks for your reply, I used PHP years and years ago and I don't 
> remember it very well but really thanks to share this solution! :)

I did in my crontab this:

*/5 * * * * /usr/bin/mysql -u my_username -h localhost -p my_password < 
/home/itoffice/query.sql

It doesn't work... :/

If I run query.sql after I did a manual login in MariaDB it works.

I think I must use php like what this site said: 
https://stackoverflow.com/questions/9948220/how-can-i-set-a-crontab-to-execute-a-mysql-query-and-log-the-output

I think also I should save php file not in my home folder like 
/home/itoffice but in /var/www/html right?

^Bart