Here is the generic syntax for counting the number of columns in MySQL table:

SELECT
  COUNT(*)
FROM
  INFORMATION_SCHEMA.COLUMNS
WHERE
  table_name = 'table_name';

If you have multiple database with the same table name, you should specify the database:

SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'database_name'
AND table_name = 'table_name';

Example, count the number of columns from the table film in database sakila:

SELECT
  COUNT(*)
FROM
  INFORMATION_SCHEMA.COLUMNS
WHERE
  table_schema = 'sakila'
  AND table_name = 'film';

Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and manage Oracle, MySQL, SQL Server, PostgreSQL, and many other databases simultaneously using an intuitive and powerful graphical interface.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS

TablePlus in Dark mode