Disable mysql daily table optimization - mysql

I'm using Turnkey Linux LAMP and I need to disable the daily table optimization performed by mysql (my tables are InnoDB). The task starts automatically with user debian-sys-maint.
I cannot find where to disable it (or at least change it frequency).
I've checked my.cnf, init.d etc with no avail.
Thanks!

I doubt this is something that is part of MySQL itself. I've certainly never seen it.
I would say that it is much more likely to be running from cron. You should be able to find it in /etc/crontab, /etc/cron.d/ or /var/spool/cron/

Related

Syslog-NG with mysql phpmyamdin not storing data real time?

I have installed syslog-ng on an ubuntu 18.04.4lts. but it looks like mysql is missing some logs. when I run syslog-ng -d I can see logs are coming in real time. But in phpmyadmin they are at least 25-30min behind. Furthermore, it is happening everyday. I have also made the changes so that there is no limit of mysql to store data. Any idea what can be wrong?
Please adjust spelling, reading this in all caps sounds like you're screaming.
In phpMyAdmin, as long as you refresh the page, you're seeing data as MySQL/MariaDB stores it; there's no delay or caching on the MySQL <--> phpMyAdmin connection. Any delay you're seeing as described here would have to be explained by syslog-ng; is there some sort of cache involved where it delays writing events to the database? That would make the most sense about why syslog-ng -d shows you the relevant logs but it takes some time to propagate to MySQL.
Really, I don't know much about using syslog-ng in this way, but based on your explanation of events, the answer has to lie there somewhere.

Locating unused indexes

What method(s) does one use to locate unused indexes on an extant MYSQL installation? Percona has tools, but these boxes are Amazon RDS instances so we don't have access to the nuts and bolts side for use of those tools.
I did locate http://hackmysql.com/mysqlidxchk and I think it may be my only option at this point. I can manually comb through and look for indexes with duplicate leading keys, but that also seems counter productive.
Are there other solutions that I am not seeing?
Yes, there is pt-index-usage, but you don't necessarily need to run it against your RDS instance.
You could collect query logs,* and then run pt-index-usage against a snapshot of your database running anywhere, even on your laptop. The tool just runs EXPLAIN for all queries in the log, and then reports any indexes that exist in the database but were not used by any EXPLAIN report.
RDS supports only table-based query logs, be careful of the overhead caused by this.
And you need to export the table-based query logs before using it as input to pt-index-usage. Here' a script that can do the export: https://github.com/billkarwin/bk-tools/blob/master/export-slow-log-table
MySQL 5.6 also has a new performance_schema table table_io_waits_summary_by_index_usage (see http://dev.mysql.com/doc/refman/5.6/en/table-waits-summary-tables.html) and you can enable this to find out how frequently each index is loaded from disk into RAM, therefore it is being used. Though you may not be using MySQL 5.6, and I don't know if you can enable performance_schema options on RDS anyway.
My colleague at Percona just posted a blog that confirms you can enable the performance_schema on Amazon RDS, though not through the Web UI. http://www.mysqlperformanceblog.com/2013/08/21/amazon-rds-with-mysql-5-6-configuration-variables/
EXPLAIN along with your query is helpful, in this regard. Try it out, if it doesn't help, say so, with what you'd like to know that's missing as a comment and I'll look into it.

Is there a way to find out the last time a mysql database was accessed?

I have a virtual hosting, I have simple online browser based ezpanel access. I can manage mysql databases through phpmyadmin.
I have many old databases that I would like to delete. But first, I would need to know, which one are still used by my websites and which are obsolete, unused, unaccessed for many months.
Is it possible to know when the last time a database was accessed?
I am asking, if there's any command that could show if db is being accessed, in use? If there's any info recorded for each db access and any command that shows it? Or any similar method?
Thank you

Mysql Table crashed. Should I repair daily?

Out of blue moon, all of sudden, 1 of my database is crashed. This is not the first time, last time I use the "repair table" command and was lucky able to fix it. But it happens again, same table, same error, same solution.
Error:
1194: Table 'users' is marked as crashed and should be repaired
Do I need to repair my tables every day/week/month? Is there a permanent solution for "table-crashing" problem? Its really scary!!! Please help
This shouldn't happen normally, if your tables are crashing it means something is wrong with your system. Likely a bad disk or bad DRAM (or one of lots of unlikely things, like bad pci->sata bridge, etc...). If you have another system around, try migrating to that system and see if your errors continue.
You do have another equivalent system around, right? In case the primary DB crashes hard, and you need to restore a backup ASAP?
I suppose it could also be a bug in mysql, make sure the version you are using doesn't have known bugs.
To debug this problem, let alone just about any other problem, start looking in your logs. If you MySQL server runs on Windows, there are event logs for application and system, and I would look at those. If your MySQL server runs on Linux, logs are usually found under /var/log, and you usually have to be root to view them. A good way to view on linux is
tail (where is replaced by the real name of the file).
As you have been advised in another answer, you might have disk issues. Run a hardware diagnostic on the disks.
Whatever you decide to do, please do not depend on repairing a table; because you soon might not be able to. Using an Informix SE database, I had to rebuild a table, and there was nothing apparently wrong with the data in the table. It was a nightmare, and took the better part of a weekend. I could not export the database, on which our test and development systems depend.

How do I oversee my MySQL replication server?

I've had a tough time setting up my replication server. Is there any program (OS X, Windows, Linux, or PHP no problem) that lets me monitor and resolve replication issues? (btw, for those following, I've been on this issue here, here, here and here)
My production database is several megs in size and growing. Every time the database replication stops and the databases inevitably begin to slide out of sync i cringe. My last resync from dump took almost 4 hours roundtrip!
As always, even after sync, I run into this kind of show-stopping error:
Error 'Duplicate entry '252440' for key 1' on query.
I would love it if there was some way to closely monitor whats going on and perhaps let the software deal with it. I'm even all ears for service companies which may help me monitor my data better. Or an alternate way to mirror altogether.
Edit: going through my previous questions i found this which helps tremendously. I'm still all ears on the monitoring solution.
To monitor the servers we use the free tools from Maatkit ... simple, yet efficient.
The binary replication is available in 5.1, so I guess you've got some balls. We still use 5.0 and it works OK, but of course we had our share of issues with it.
We use a Master-Master replication with a MySql Proxy as a load-balancer in front, and to prevent it from having errors:
we removed all unique indexes
for the few cases where we really needed unique constraints we made sure we used REPLACE instead of INSERT (MySql Proxy can be used to guard for proper usage ... it can even rewrite your queries)
scheduled scripts doing intensive reports are always accessing the same server (not the load-balancer) ... so that dangerous operations are replicated safely
Yeah, I know it sounds simple and stupid, but it solved 95% of all the problems we had.
We use mysql replication to replicate data to close to 30 servers. We monitor them with nagios. You can probably check the replication status and use an event handler to restart it with 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; Start Slave;'. That will fix the error, but you'll lose the insert that caused the error.
About the error, do you use memory tables on your slaves? I ask this because the only time we ever got a lot of these error they where caused by a bug in the latests releases of mysql. 'Delete From Table Where Field = Value' will delete only one row in memory tables even though they where multiple rows.
mysql bug descritpion