I\'m on a Mac OS Yosemite using Laravel 5.0.
While in my local environment, I run php artisan migrate
I keep getting :
If you have an error returning something like PDOException in Connector.php line 55: SQLSTATE[HY000] [1049] Unknown database 'laravelu'
is due to you are changing your batabase config as DB_DATABASE=laravelu
. So for now you either:
DB_DATABASE=
[yourdatabase]
orlaravelu
in your phpmyadminthis should be able to solve it
in my case (laravel 5+) i had to wrap my password in single quotation marks and clear config cache:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=user_name
DB_PASSWORD='password'
and then run:
php artisan config:clear
Log into MYSQL - use the mysql database.
Select * from User;
Make sure that your HOST column is correct. It should be the host that you are connecting from (your application server) be it IP address, or DNS name. Also '%' will work (meaning wildcard) but will not be secure.
Find unix_socket location using MySQL
mysql -u homestead -p
mysql> show variables like '%sock%';
+-----------------------------------------+-----------------------------+
| Variable_name | Value |
+-----------------------------------------+-----------------------------+
| performance_schema_max_socket_classes | 10 |
| performance_schema_max_socket_instances | 322 |
| socket | /var/run/mysqld/mysqld.sock |
+-----------------------------------------+-----------------------------+
3 rows in set (0.00 sec)
Then I go to config/database.php
I update this line : 'unix_socket' => '/tmp/mysql.sock',
to : 'unix_socket' => '/var/run/mysqld/mysqld.sock',
That's it. It works for my as my 4th try.I hope these steps help someone. :D
I had the same issue and in the end It turned out that I just had to restart the server and start again
Ctrl + c then
php artisan serve