This section provides information on how to run SQL queries with Drush on Pantheon.
drush sql-cli and
drush sql-connect commands are not supported on Pantheon. For security reasons, the SQL database is not directly accessible from your local machine.
You can, however, use Terminus as follows:
echo 'SELECT * FROM users WHERE uid=1;' | terminus drush SITENAME.ENV sql:cli
Note that certain characters such as
; cannot be used in the query. You will receive an error message if you use an illegal character:
Command not supported as typed.
Note that the trailing
; in the SQL query is optional in this context.