Kim Carlo
Kim Carlo

Reputation: 1223

Laravel 5.1: migrate command doesn't work 'unknown database'

I'm facing problems with my laravel project built with laravel 5.1.

So I developed a reservation system with laravel, it works on my local server.

Then I uploaded it to my live server and started an SSH session.

But when I ran php artisan migrate command, I get this error:

[PDOException] SQLSTATE[HY000] [2005] Unknown MySQL server host 'sddb0040291787.cgidb' (0)

So, what I did so far is I wrote a PHP script to create the tables and other database related stuff and then run the PHP script on my server.

This works actually, my CRUD functions are working but I know this is just a temporary solution.

What I'm looking for is a permanent solution. Plain PHP scripts seem to be able to connect to the database host. but when I migrate using laravel, the error always shows up. Any ideas?

Upvotes: 0

Views: 104

Answers (1)

Mr. Pyramid
Mr. Pyramid

Reputation: 3935

check your .env or database.php you have

'host'      => 'sddb0040291787.cgidb'

which is not validname it should be localhost or any domain name which will look like a webaddress or it should be an IP.

Also refer: Similar questions on SO: REF1 & REF2

Hope it will help.

Upvotes: 1

Related Questions