0

Want to print the value of a variable I create.

    SET @count = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'wordpress');

    PRINT @count + 1;

The above code is saved into a file called count-new.sql.

I execute the above code using the following WP-CLI (a command line for WordPress) code:

    sudo wp db query < count-new.sql --allow-root

And receive the following error: ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your...

Any help appreciated.

1 Answers1

0

I understood from documentation that .sql file must containt only the query

downtheroad
  • 409
  • 4
  • 11