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

^Bart <[email protected]> Thu, 2 Nov 2023 09:50:52 +0100
Newsgroups comp.databases.mysql
Organization A noiseless patient Spider
Message-ID <[email protected]>
> You don't need anything but SQL and the CLI.

Ok!

> Just create a text file with the SQL commands necessary to use the 
> database, truncate the table and import from the file.  Call it 
> reload.sql, for instance.

Ok.

> Then use the CLI source command to run that file, i.e.
> 
> mysql -u user -ppassword
> source reload.sql

So... I should have a file where I'll store the login data and I could 
name it like "login.sql" and inside of it I should insert the "reload.sql".

At the end I should add the link to "login.sql" in crontab because I 
should run it every 5 minutes.

> Or you could do it with
> 
> mysql -u user -ppassword < reload.sql

Ok.

> It's not a good idea to have the password in a file.

I know but this is a test machine inside of my lan, it's not in DMZ and 
just me or one colleague can login to it but you got the point about 
security risks and in your opinion could I solve this "issue" with the 
idea showed in the link which I posted in my first message or do you 
have another idea?

Regards.
^Bart