4

How I can create the initial database on migrations of laravel?

For when I do command

php artisan migrate

returns me the following message

[PDOException] SQLSTATE [HY000] [1049] Unknown database

Thanks

5
  • 1
    Have you configured app/config/database.php? Laravel will not create a database, only tables. Commented Jun 11, 2014 at 14:49
  • Do you want create table on the db by use migrate? Commented Jun 11, 2014 at 14:53
  • no i want create database in migrate Commented Jun 11, 2014 at 14:55
  • 1
    No, you can't. You should create database use sql command, or operation in phpmyadmin. Commented Jun 11, 2014 at 14:57
  • thanks man, any other away to create db in application? Commented Jun 11, 2014 at 15:03

2 Answers 2

1

Artisan does not create the database, only database tables. You're going to need to create the DB yourself first (in whatever DB tools you have, not Laravel) then run run your migrations.

Sign up to request clarification or add additional context in comments.

Comments

0

You cannot create a database through Laravel, you need to have one before-hand. If you use the MySQL default, do it through MySQL and then enter the database credentials in app/config/database.php - including what the database is called. (Note that you will also need a user that has access to that database.)

If you have no idea what I'm talking about, you may want to use SQLite, since that doesn't require further knowledge about creating databases, and Laravel provides a sensible default. Again, you can configure this in the database configuration file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.