Copia de seguridad automática de MySQL en host compartido

As I am not a coder so I should stop here but I am interested how far I could go to build an automatic SQL script.

Case: A website is hosted on a shared host server which uses CPanel. The website use only one DB and one of the table is the log. Now the log table has reached 300k rows... (I might do something wrong here... it is a popular website?:))

So I need to reduce the log table but I would like to do a backup rather. So here is my idea:

Setup a backup DB and copy the old entries meanwhile use tables for only quarter years so the log from Jan-April would be stored in table_2012-q1 etc.

Método:

I would like to use cron and email alert.

Preguntas:

  1. is there any better and easier solution to do the back up with this row num.
  2. if I do a "move rows" by INSERT/DELETE rows how can I check which one is ready on time?
  3. do I need to focus on the performance of this process as it should work in the background? In other words is it a select or a dump?

Sorry if it is too Dummy but I would like to learn! I also don't want to use too much processor for this.

Thanks Andras

preguntado el 31 de julio de 12 a las 14:07

does your database access the oldest files (ex : 1-25k) ? -

not really it is only for admin to check what happened for reference... -

1 Respuestas

Since you are using shared hosting, I'm pretty sure you will not be able to access cron, so here is an alternative:

Since the database is filled with log data :

1. Create a new table, regardless of the name or time period
2. Move the files (from a certain id) from one table to the next

This link will explain better : base de datos parcial mysqldump

If this is active DB, I would clone it and then play around with the ways the data will be moved since you do not consider youreself a coder.

Espero que esto ayude.

contestado el 23 de mayo de 17 a las 12:05

thanks for your comment I can run 3 cron scripts provided by my shared host provider - Esforzarse más

The reason behind to create another DB because I don't want to overload meanwhile users still want to use it. - Esforzarse más

thats why i asked if it is still being used. If it is -> then you'll need to rewrite code to make sure to look at the correct database based on the time period. - mlishn

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.