Groups | Search | Server Info | Login | Register


Groups > comp.databases.mysql > #7671

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

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "J.O. Aho" <user@example.net>
Newsgroups comp.databases.mysql
Subject Re: From bash script (Debian Bookworm) login and query to MariaDB
Date Thu, 2 Nov 2023 12:22:01 +0100
Lines 43
Message-ID <kqhf2pFtbq4U1@mid.individual.net> (permalink)
References <uhr78k$13p7r$1@dont-email.me> <uhrmcl$16ilv$2@dont-email.me> <uhvn6g$23nq2$1@dont-email.me> <uhvun1$256tt$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net hwDg/5AN0KN6xJtqnGudjg8GJSQ9YQU3OFzrWLA3lK6R4jukC5
Cancel-Lock sha1:rjkuyHzlAyfWYK6gVYU0YuJg2qQ= sha256:LrOu09UmzVR9VN4vRYYlD1bcNGQV29NFaWx6Yi0/V7Q=
User-Agent Mozilla Thunderbird
Content-Language en-US-large
In-Reply-To <uhvun1$256tt$1@dont-email.me>
Xref csiph.com comp.databases.mysql:7671

Show key headers only | View raw


On 02/11/2023 11.46, ^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


this in /etc/crontab or did you use it as your personal crontab with 
"crontab -e"?

if the later, then your user need to have the right to read the file and 
of course have the right to access the content in the itoffice directory.

if /etc/crontab then add who is executing the command and it can be good 
to put parentheses around command too

*/5 * * * * (root) (/usr/bin/mysql -umy_username -pmy_password 
databasename <
  /home/itoffice/query.sql)



> 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

No you don't, it's just what he did.


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

That is much about how you use the php script, if you use it like a bash 
script then no you don't put it there. If it's part of your web site, 
then yes.

Php can be used for websites, scripting and even create gui 
applications, it may not be the best option in all situations.

-- 
  //Aho

Back to comp.databases.mysql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-10-31 16:42 +0100
  Re: From bash script (Debian Bookworm) login and query to MariaDB The Natural Philosopher <tnp@invalid.invalid> - 2023-10-31 20:00 +0000
    Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 09:39 +0100
      Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 11:46 +0100
        Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-02 12:22 +0100
          Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 15:07 +0100
            Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-02 15:57 +0100
        Re: From bash script (Debian Bookworm) login and query to MariaDB Jerry Stuckle <stuckle.jerry@gmail.com> - 2023-11-02 12:06 -0400
          Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-03 15:42 +0100
            Re: From bash script (Debian Bookworm) login and query to MariaDB The Natural Philosopher <tnp@invalid.invalid> - 2023-11-03 16:45 +0000
              Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <none@none.it> - 2023-11-04 09:42 +0100
                Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-04 10:09 +0100
                Re: From bash script (Debian Bookworm) login and query to MariaDB Jerry Stuckle <stuckle.jerry@gmail.com> - 2023-11-04 12:56 -0400
                Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-05 11:23 +0100
                Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-05 12:56 +0100
  Re: From bash script (Debian Bookworm) login and query to MariaDB Marco Moock <mm+usenet-es@dorfdsl.de> - 2023-10-31 21:01 +0100
    Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 09:40 +0100
  Re: From bash script (Debian Bookworm) login and query to MariaDB Jerry Stuckle <stuckle.jerry@gmail.com> - 2023-10-31 19:06 -0400
    Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 09:50 +0100
      Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-02 12:03 +0100
  Re: From bash script (Debian Bookworm) login and query to MariaDB "J.O. Aho" <user@example.net> - 2023-11-01 08:04 +0100
    Re: From bash script (Debian Bookworm) login and query to MariaDB ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-11-02 10:09 +0100

csiph-web