300mb database? how busy/big is your website? sometimes spam comments can take up a ton of space. you can clean out the comments via phpmyadmin if you can’t get into wp-admin. ‘antispam bee’ plugin helps a lot to prevent spam.
Can you contact your host and access the database via cpanel/plesk -> phpmyadmin? while in there, you can “optimize” the tables which will remove overhead (which can take up a lot of space: it’s basically cache).
Another option if your site is overly busy is you can disable andor remove post revisions. they save every alteration to every post, which on busy sites can take a ton of space.
If your site is big and awesome, and the 300mb is actually real data, just upgrade your hosting (though I’ve never seen a host restrict mysql size.. Usually you see 300mb with sever storage or bandwidth, are you sure it’s not one of those?)
Could be spam; you can truncate the wp_comments table with a database utility to delete all comments at once. (Use phpmyadmin in your Cpanel, or adminer http://www.adminer.org/ as a standalone file you can drop in via FTP).
Clearing post and page revisions will greatly reduce the size of a WP database – up to 90% in some cases (with a huge return in site speed.)
Since you can’t log into admin, run the query below as an SQL query in phpmyadmin to delete revisions; change table prefix as necessary. (Use phpmyadmin in your Cpanel, or adminer http://www.adminer.org/ as a standalone file you can drop in via FTP).
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
Then optimize all tables. And then add
define ('WP_POST_REVISIONS', FALSE);
near the top of wp-config.php to prevent the creation of all future revisions.
davidsword – The site is not big or busy at all, it’s very small but does have several years of blog posts. I ran the SQL query that songdogtech suggested and it did clear a lot of rows of data. However, it still says 300.1 Mb of 300 used.
I tried to optimize tables but I didn’t see the option in phpMyadmin. When I selected a table and check all of the fields the only options I see are Browse, Change, Drop, Primary, Unique, Index, and Fulltext. Am I looking in the wrong place? Sorry if this is a simple question, I am by no means a professional here.
Here’s how to optimize with phpmyadmin
http://hfx.link/blQ6
If you don’t see that you may not have user permission to preform that task.
You may want to talk to your hosting provider, if you deleted “a lot” and the size of the database didn’t change: something may be wrong with the host.
Okay, i found it in a different location. It says I don’t have permission because the INSERT command is denied to the user. I’ve contacted my host (Network Solutions) and they’ve said they’re not allowed to do anything database related. Any way to get that INSERT command available? Any other suggestions?