Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mysql maintenance: optimize databases to kill overhead
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Sat Dec 01, 2012 2:09 pm    Post subject: mysql maintenance: optimize databases to kill overhead Reply with quote

hi there!

the tables of various databases are updated daily, multiple times.
Therefore, I want to analyze(update index) and optimize all databases
with their respective tables to kill the table overhead every now and then.

so, I wonder how to do that the best way.

some ideas:

1 run mysqlanalyze as a cronjob.
mysql_cleanup wrote:
#!/bin/bash

mysqlanalyze --user root --password --analyze --all-databases
mysqlanalyze --user root --password --optimize --all-databases
though, I do not want to have a user with cleartext password there, which has write access.

2 run a php script to iterate over databases and their tables. same issue as before ...

am I paranoid about the password?! :roll:

3 add a mysql user with minimal rights to execute the maintenance task via 1.

which rights would that be?
I read somewhere SELECT and INSERT would be enough ...

then ...

3a just have the cleartext password inline.

3b read a file's content for the encrypted password and pass it decrypted to the commandline.

4 execute the maintenance task at the end of the update process every Xth time for selected database.

5 any other ideas?


I just cannot decide which one is the one proper way for the maintenance task to be executed. :evil:


hmm ... looking at it a bit I think I favor 3a. then, the question is what rights are necessary?


Thank you for your aid!
_________________
hear hear
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Dec 01, 2012 7:40 pm    Post subject: Reply with quote

If you're worried about someone being able to read root's crontab, which is only readable by root in the first place, I'd say your system's already compromised.
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Mon Dec 03, 2012 8:10 am    Post subject: Reply with quote

true, true. so I decided to use mcrypt, so that the pass is not cleartext at least. just for the fun of my paranoia. :o

with that I found out about bash's trap function, with a strange "feature". but I will post about that in another thread.
edit #1 well, or just peek at portage shell scripts howto do this and it works. :o
_________________
hear hear
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum