Drush Cex unable to query database

I’m hoping someone can help me. We’ve been working on this problem and it turns out Drush is unable to query my database. Here’s the log.

Drush Launcher Version: 0.10.1 ROOT: /Users/myusername/Sites/ed-git DRUSH VERSION: 10 DRUPAL ROOT: /Users/myusername/Sites/ed-git/web COMPOSER ROOT: /Users/myusername/Sites/ed-git VENDOR ROOT: /Users/myusername/Sites/ed-git/vendor [preflight] Config paths: /Users/myusername/Sites/ed-git/vendor/drush/drush/drush.yml [preflight] Alias paths: /Users/myusername/Sites/ed-git/web/drush/sites,/Users/myusername/Sites/ed-git/drush/sites [preflight] Commandfile search paths: /Users/myusername/Sites/ed-git/vendor/drush/drush/src [debug] Bootstrap further to find cex [0.08 sec, 9.52 MB] [debug] Trying to bootstrap as far as we can [0.08 sec, 9.52 MB] [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.08 sec, 9.52 MB] [debug] Change working directory to /Users/myusername/Sites/ed-git/web [0.08 sec, 9.52 MB] [debug] Initialized Drupal 9.3.9 root directory at /Users/myusername/Sites/ed-git/web [0.08 sec, 9.52 MB] [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.08 sec, 9.53 MB] [debug] Initialized Drupal site default at sites/default [0.09 sec, 9.69 MB] [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.09 sec, 9.69 MB] [debug] Add service modifier [0.09 sec, 9.94 MB] [debug] Unable to connect to database with message: SQLSTATE[HY000] [2002] No such file or directory. More debug information is available by running drush status. This may occur when Drush is trying to bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the –uri parameter on the command line. See drush topic docs-aliases for details. [0.09 sec, 10.16 MB] [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration() [0.09 sec, 10.15 MB] [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find cex again. [0.09 sec, 10.15 MB]

In Application.php line 244:

[SymfonyComponentConsoleExceptionCommandNotFoundException]
Command cex was not found. Drush was unable to query the database. As a res
ult, many commands are unavailable. Re-run your command with –debug to see
relevant log messages.

Exception trace: at /Users/myusername/Sites/ed-git/vendor/drush/drush/src/Application.php:244 DrushApplication->bootstrapAndFind() at /Users/myusername/Sites/ed-git/vendor/drush/drush/src/Application.php:196 DrushApplication->find() at /Users/myusername/Sites/ed-git/vendor/symfony/console/Application.php:237 SymfonyComponentConsoleApplication->doRun() at /Users/myusername/Sites/ed-git/vendor/symfony/console/Application.php:149 SymfonyComponentConsoleApplication->run() at /Users/myusername/Sites/ed-git/vendor/drush/drush/src/Runtime/Runtime.php:118 DrushRuntimeRuntime->doRun() at /Users/myusername/Sites/ed-git/vendor/drush/drush/src/Runtime/Runtime.php:48 DrushRuntimeRuntime->run() at /Users/myusername/Sites/ed-git/vendor/drush/drush/drush.php:72 require() at /Users/myusername/Sites/ed-git/vendor/drush/drush/includes/preflight.inc:18 drush_main() at phar:///usr/local/bin/drush/bin/drush.php:143 require() at /usr/local/bin/drush:14

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drush Cex unable to query database

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.