Valet: laravel Valet setup issue with Database

Created on 12 Jan 2019  Â·  6Comments  Â·  Source: laravel/valet

Hello there,

I'm trying to setup laravel valet but I'm stuck at running php artisan migrate:fresh.

I get the following error:

   Illuminate\Database\QueryException  : SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

  at /Users/arnedebelser/Sites/the-social-pigeon/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

I know this has something to do with my db settings in my .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=root
DB_PASSWORD=

I have no clue what to fill in for DB_DATABASE=

All 6 comments

Hi,
Valet doesn't install any database services.

You are welcome to install mysql or mariadb using Homebrew if you wish. There's a note about how to do that in the Valet docs: https://laravel.com/docs/5.7/valet#installation

Once you have a database engine installed, you can then create a database for your app. With MySQL or Mariadb, you can do this with this command:

mysqld -uroot
create database put_your_new_database_name_here;

(press CTRL+D to exit the mysqld app)
Then you can put your database name into your laravel .env file. That part's all in the Laravel docs.

@aFluxx did you get this sorted?

@drbyte I was thinking about this the other day, currently I set up an alias to start up a mysql service and valet together, but would there be an appetite for potentially allowing database services to be set up with valet (optionally) or do you reckon this is too opinionated for valet?

E.g:

// This could ask a series of questions for user, database, etc on initial set up if not already set up
valet database {db service, e.g [email protected]}

// Would be stored in config the linked database so would start the brew service alongside
valet start

// Would remove the link to a database service for valet to run
valet database remove

@jrbarnard My gut feel is that this is too opinionated for Valet's vision.

I'm trying to think of a normal scenario where the database engine wouldn't be started already.
And if it's not installed, I would think that it should be left to the user to install the database app/s that they wish. The "how" for that is explained in the Valet docs, and it's valid to encourage the user to learn a little about homebrew anyway ... otherwise this repo will require even more handholding support about how to install/start/stop/remove/change/fix/etc all of the possible different database choices, and if Valet is storing some memory of whatever their prior choices were, then they're gonna be asking for help on how to change that. Given that installing and starting a db engine is straightforward for those who actually need it, that really should be left to the end user IMO. Even the novice should take the time to learn those basics, as that'll empower them to understand their devops team better too.

Just my longwinded 3cents' worth.

I did not manage to get this sorted yet, but it seems I have Some problems getting mysql Running on my Mac. I have added it to the path but When I run the mysql commands the terminal tells me it cant run them. Ill get back to this once I fix that issue.

Outlook voor iOShttps://aka.ms/o0ukef downloaden


Van: Chris Brown notifications@github.com
Verzonden: zondag, januari 20, 2019 11:46 PM
Aan: laravel/valet
CC: De Belser Arne (aFluxx); Mention
Onderwerp: Re: [laravel/valet] laravel Valet setup issue with Database (#702)

@jrbarnardhttps://github.com/jrbarnard My gut feel is that this is too opinionated for Valet's vision.

I'm trying to think of a normal scenario where the database engine wouldn't be started already.
And if it's not installed, I would think that it should be left to the user to install the database app/s that they wish. The "how" for that is explained in the Valet docs, and it's valid to encourage the user to learn a little about homebrew anyway ... otherwise this repo will require even more handholding support about how to install/start/stop/remove/change/fix/etc all of the possible different database choices, and if Valet is storing some memory of whatever their prior choices were, then they're gonna be asking for help on how to change that. Given that installing and starting a db engine is straightforward for those who actually need it, that really should be left to the end user IMO. Even the novice should take the time to learn those basics, as that'll empower them to understand their devops team better too.

Just my longwinded 3cents' worth.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/laravel/valet/issues/702#issuecomment-455909835, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfQYnyJyitvJTyzXffQB_hxMbrA89I39ks5vFPHKgaJpZM4Z8lke.

Hey,

I managed to solve the issue, I don't quiet remember exactly all the steps I took. But it works..
If I could remember I would write them down here..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webartistse picture webartistse  Â·  4Comments

marianvlad picture marianvlad  Â·  5Comments

VinceG picture VinceG  Â·  3Comments

hsleewis picture hsleewis  Â·  5Comments

pmochine picture pmochine  Â·  5Comments