Giter Club home page Giter Club logo

mysqlfragfinder's People

Contributors

doesntmatter avatar eusonlito avatar fevangelou avatar iangregory avatar niklasalbin avatar pdufault avatar pixilla avatar websoftix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysqlfragfinder's Issues

How to run it from cron?

Hello,
If I try to run it from cron I get:

tput: No value for $TERM and no -T specified

how to... ? thanks and Happy New Year

Escape database name

Hello,
your script doesn't work as expected on databases with special charasters like dash (the "-") in their name.

The problem is in this:
fragmented=( $("${mysqlCmd}" -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" --skip-column-names --batch -e "SHOW TABLE STATUS FROM $i;" 2>"$log" | awk '{print $1,$2,$10}' | egrep "MyISAM|InnoDB" | awk '$3 > 0' | awk '{print $1}') );

If the $i equals for example my-database, the query will end in error. you have to add escaped quotes like this:
fragmented=( $("${mysqlCmd}" -u"$mysqlUser" -p"$mysqlPass" -h"$mysqlHost" --skip-column-names --batch -e "SHOW TABLE STATUS FROM $i;" 2>"$log" | awk '{print $1,$2,$10}' | egrep "MyISAM|InnoDB|Aria" | awk '$3 > 0' | awk '{print $1}') );

(Adittionaly I added the Aria datastore, because I use it a lot and the OPTIMIZE works just like with the MyISAM)

However, I'm not sure how specific the problem is. Maybe it's just my problem :). But after this fix, script sucessfully optimizes all my databases. Before the fix, there was 90% of fragmented tables untouched.

Regards,
Vlastimil Kotas

.my.cnf parsing issues

Hi,

I have noticed a few issues with the .my.cnf part of the script.

Firstly, the wrong variable is set on line 45: mysqlpassword:

mysqlpassword=$(grep password= < "$HOME/.my.cnf" | awk -F\" '{print $2}');

It ought to read:

mysqlPass=$(grep password= < "$HOME/.my.cnf" | awk -F\" '{print $2}');

Secondly, in my .my.cnf the password is passed with "pass=". I understand this can be done two ways but it would seem that it could be an idea to make both possible.

This is my original configuration file, which works fine with normally:

[client]
pass="[deleted]"
user=root

Also, the script failed to pick up my user name because it wan't enclosed with quotation marks. So, I had to change my configuration file to:

[client]
password="[deleted]"
user="root"

It could be an idea to make the script a bit more tolerant.

Niklas

Tables always fragmented

Hello,

i have a problem with this script, i run the script wihtout problems and i sais to me:

N tables were fragmented, and were optimized.

But if i run again, also only in check mode:

Checking XXXX ... found N fragmented tables.

In phpmyadmin all tables overhead is 0, so my question is: after the script my tables are really optimized or not?

(i know, sorry for my bad english)

Thanks!

what about sh users ?

Hi,

I am on FreeBSD, I dont have bash, but using sh. Any possibility to port this script also for sh environment ?

Thanks.

Support --port

I run my MYSQL on port 3319, had to implement the --port along with the --port="$mysqlPort" on each command. Can't do a pull request right now, but the modification isn't hard at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.