Comments on new posts can be disabled under Settings/Discussion in the admin interface. Unclick “Allow people to post comments on new articles “.
This, however, will not disable comments on any posts that already exist. For those, you can issue this line of SQL:
mysql> UPDATE wp_posts p SET comment_status = 'closed', ping_status = 'closed' WHERE comment_status = 'open'; Query OK, 18557 rows affected (0.13 sec) Rows matched: 18557 Changed: 18557 Warnings: 0 mysql>
If you have WP-CLI, you can access the SQL command-line with the “wp db cli” command:
$ wp db cli Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 82479 Server version: 5.5.40-0+wheezy1 (Debian) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed' WHERE comment_status = 'open'; Query OK, 0 rows affected (0.04 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql>