Last active
May 21, 2017 21:56
-
-
Save cedricmagne/4efe09ef0ff003b3c064 to your computer and use it in GitHub Desktop.
MySQL command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Show triggers | |
SHOW TRIGGERS; | |
-- Show free lock | |
SELECT IS_FREE_LOCK('DATABASE_NAME.reindex_full') | |
-- Log all queries | |
-- Mysql need to have write access on mysql_general.log | |
SET global log_output = 'FILE'; | |
SET global general_log_file='/var/log/mysql/mysql_general.log'; | |
SET global general_log = 1; | |
-- Change ROW_FORMAT OPTION | |
sed -i -e 's/ROW_FORMAT=FIXED/ROW_FORMAT=DYNAMIC/g' your_file.sql | |
-- If sed: RE error: illegal byte sequence | |
export LC_CTYPE=C | |
export LANG=C | |
-- Détecter et lister les tables fragmentées | |
SELECT CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) AS Name,Data_free \ | |
FROM information_schema.TABLES \ | |
WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql') AND Data_free > 0; | |
OPTIMIZE TABLE my_database.my_table; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment