Jump to content

Calling mysql in batch mode as Cron command - need for trailing "QUIT" ?


rupertrealbear

Recommended Posts

Hi

 

I managed to alter something in my MySQL database (on a VPS) by creating a user "cron" with no priviledges and then granting it a few table-specific priviledges in the database in question.  A small text file was created containing some MySQL statements:

mysql -h localhost -u cron < quick.txt

quick.txt just connected to the databse and updated the test field in a table called sample:-

USE crontest;
UPDATE sample SET test = "changes successful";

My plan is to use a cron job to perform some useful databse housekeeping one every minute.  I notice that you are advised to use the "QUIT" command (if calling mysql in batch while logged in on the local machine).

Would adding "QUIT;" at the end of quick.txt achieve that end?

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.