Knowledgebase

How to run OPTIMIZE TABLE ??

Posted by kotlt, 03-25-2009, 01:58 PM
Hello, i'm new in vps. Today i need to run "OPTIMIZE TABLE" from MySQLTuner recommendation. Now i don't know how to run it ? I try to put in SQL Query via phpmyadmin and: SQL query: OPTIMIZE TABLE MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Please help me !!!

Posted by Steve_Arm, 03-25-2009, 02:05 PM
You need to add the table name. OPTIMIZE TABLE table_name_here;

Posted by Eric - Zoidial, 03-25-2009, 02:05 PM
You could run from the command line something like: mysqlcheck --optimize -A -u username -ppassword Which will optimize all tables, just change the 'username' and 'password' to your administrator user and pass for mysqld.

Posted by kotlt, 03-25-2009, 02:21 PM
I run vbb forum and currently i have 150 table. How to run this query on all tables ? I have error You should give only options, no arguments at all, with option --all-databases. Please see mysqlcheck --help for more information. p/s: it work with "mysqlcheck --optimize -u username -p dataname" now Last edited by kotlt; 03-25-2009 at 02:27 PM.

Posted by Eric - Zoidial, 03-25-2009, 02:28 PM
This works with this version: mysqlcheck --version mysqlcheck Ver 2.4.4 Distrib 5.0.77 Make sure you are putting the password right after the -p, as in "-ppassword" without a space, else it may throw that error.

Posted by Quel, 03-25-2009, 04:51 PM
mysqlcheck is the best, but if you want the SQL use ; OPTIMIZE ; where table is the table name , not a command Regards Quel



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Caro.net Down (Views: 685)
Dreamweaver CS3 (Views: 637)


Language:

Client Login

Email

Password

Remember Me

Search