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

Jerry Stuckle <[email protected]> Thu, 2 Nov 2023 12:06:12 -0400
Newsgroups comp.databases.mysql
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 11/2/2023 6:46 AM, ^Bart wrote:
>> 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
> 

No space between your -p and your password.  This is different from 
other parameters.

-- 
==================
Remove the "x"'s from my email address
Jerry Stuckle
[email protected]
==================