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

^Bart <[email protected]> Sun, 5 Nov 2023 11:23:51 +0100
Newsgroups comp.databases.mysql
Organization A noiseless patient Spider
Message-ID <[email protected]>
> Did you look at the mail from crontab? by default it goes to the 
> localhost root user (you can change that with setting the MAILTO 
> variable), if something wen t wrong while running the mysql command it 
> will be in that mail (if no output, no mail).
> 
> You could check your /var/log/mysql/mysql.{err,log} too
> 
> I hope the "-u MY_USER" was a typo, otherwise loose the space after '-u'.

I found this solutions:

*/5 * * * * /home/itoffice/job01.sh

This is job01.sh

#!/bin/bash
#sostituisce tutte le virgole presenti nel file con dei punti
sed -i -e 's/,/./gip' /home/itoffice/data_bridge/articoli.txt

/usr/bin/mysql -umy_username -pmy_password < /home/itoffice/articoli.sql

#copia del file importato nella directory di backup
mv -v /home/itoffice/data_bridge/articoli.txt 
"/home/itoffice/data_bridge_bck/articoli_$(date +"%d-%m-%Y_%H-%M".txt)"

I found these information to fix php load data:

https://itecnote.com/tecnote/php-load-data-local-infile-forbidden-after-php-mariadb-update/
https://itecnote.com/tecnote/php-load-data-local-infile-forbidden-after-php-mariadb-update/

But now I need to do other things in my company so... I know it's a 
dirty way to use a *.sh file but I dont't have free time to fix it maybe 
next weeks... ;)

Have a nice day!
^Bart