If I put in this command in the root file in terminal:
User: rootfile $ drush config-set system.theme default atlas

I get this, apparently commonplace error:

Command config-set needs a higher bootstrap level to run - you will  [error]
need to invoke drush from a more functional Drupal environment to run
this command.

I've seen lots of this error in my google searches but can't seem to find a working solution yet for my own particular problem. I am using MAMP and working locally

I'm new to drush and drupal too. But I'm trying to make my own theme and have drush installed. My drush status command returns:

Drush was attempting to connect to: 
 Drupal version         :  8.3.7                                    
 Site URI               :  http://default                           
 Database driver        :  mysql                                    
 Database hostname      :  localhost                                
 Database port          :  3306                                     
 Database username      : admin                                  
 Database name          :  foo                       
 PHP configuration      :                                           
 PHP OS                 :  Darwin                                   
 Drush script           :  /usr/local/bin/drush                     
 Drush version          :  8.1.14                                   
 Drush temp directory   :  /tmp                                     
 Drush configuration    :                                           
 Drush alias files      :                                           
 Drupal root            :  /Users/MYUSERNAME/Desktop/SITENAME/ROOT
 Drupal Settings File   :  sites/default/settings.php               
 Site path              :  sites/default                            
 Sync config path       :  ../config/sync    

Can someone please give me a bit more details on how to implement the solution here?
Are the blank values supposed to be filled in by something? I installed drush by composer and assumed it had all its dependencies.

Comments

mmjvb’s picture

Probably not available, meaning you can't start it from the command line because its location is not in your PATH.

Don't know for your version but mine says Database: Connected
as last Database parameter.

EDIT: Updated drush and it still shows connected.

aaronsssp’s picture

It's a MySQL Problem.

On your terminal write: 
mysql
if you see: Unknown command 'mysql'

Then write:
drush cex --debug

If you see something like that:
Executing: mysql --defaults-extra-file=/private/tmp/drush_yCOXu6 --database=cogeco_dev --socket=/var/mysql/mysql.sock --port=8889 --silent  < /private/tmp/drush_wfnG9m
  sh: mysql: command not found

Then you have to install mysql
On Mac OS install Brew: https://brew.sh

Brew install mysql

Your problem will be solved after that

vermauv’s picture

This is how I solved it,
Drush looks for the mysql.sock file under /tmp directory (you can confirm that via the Error 2002 shown by drush cex --debug)
Now, find your my.cnf under mamp/mysql directory and copy the socket path.
create a symbolic link from the socket under mamp directory to tmp directory
eg. ln -s /Applications/MAMP/mysql/tmp/mysql.sock /tmp/mysql.sock

amittarkar’s picture

what should I do If my database is running on aws RDS?

Partha Sarathi’s picture

To solve this:

I followed above comments and checked if mysql is running or not

and found mysql command is not recognized!

So run this command drush cex --debug

found that it's can't connce to mysql due to mysql.sock file which supposed to be in /tmp/ folder, so took it from /Applications/MAMP/mysql/tmp/mysql.sock and put it.

Now again check if mysql is found if not then we have to install it with Brew install mysql

It should installed mysql but will not run automatically, check it by just typing mysql and see if it's running!

if not then start mysql with it run brew services start mysql. By default, brew installs the MySQL database without a root password.

You can log in mysql now with mysql -u root -p and do whatever you want to do!

I was having issue with importing drupal 8 config from db with drush and found this issue!

sowndharya’s picture

Using Xampp in my case, Is this solution will work for me? .I am not able to find mysql.sock file inside my MySQL folder.

frondeau’s picture

- Check Mysql PATH is defined in environment variables (Windows)

- Check mysql server is started.

shobhit_juyal’s picture

If you are using XAMPP on a Windows 10 machine. 

1) Goto the directory where xampp installed like "cd c:/xampp".

2) The, cd into "bin"

3) Enter command  "mysql", 

4) If you get "Access denied for user xxxx" that means it know the "mysql" and you are in correct directory,

5) Now place the same path into your environment variable settings into PATH variable.

6) Click on New add the path then ok and ok.

7) Close the terminal and re-open it to type "mysql" again.

8) Now this you should be asked for Access instead of not recognized command.

Thanks

joginderpc’s picture

Thanks, buddy you answer saved my time.

omkarms’s picture

Make sure, lando is start.
In my case after starting lando, my issue got resolved.

arunverma’s picture

In my case, it was related to connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell.

So if you are on mac or linux just run command as sudo user:
Ex: sudo drush <commnad>

Thats works for me.