This article describes the Laravel execution migrate command prompt: No Such a workaround for file or directory. Share to everyone for your reference, specific as follows:
Today using the Laravel command-line tool to manipulate the database migration operations times wrong, prompted MySQL 2002 error, as shown in figure:
View database configuration Yes, the site can also open the front desk, the explanation can connect, that is what reason?
In Laravel5, there are two ways to solve this problem:
1. Add a Database configuration entry
' MySQL ' => ['
driver ' => ' mysql ',
' host ' => env (' db_host ', ' localhost '),
' database ' = > env (' db_database ', ' Forge '),
' username ' => env (' db_username ', ' Forge '),
' password ' => env (' Db_ PASSWORD ', '),
' charset ' => ' UTF8 ',
' collation ' => ' utf8_general_ci ', ' unix_socket ' => '/applications/mamp/tmp/mysql/mysql.sock ',
' prefix ' => ' laravel_ ',
' strict ' => False,
],
One of the added here is Unix_socket, the MAMP environment on the MAC, the path is/applications/mamp/tmp/mysql/mysql.sock, the way to view your path is to enter the following command in MySQL to see:
Show variables like '%sock% ';
As shown in the following illustration:
2. Modify. ENV Configuration
This method can only be temporarily modified, so that migrate can be executed, and then must be changed back.
Db_host=localhost
db_connection=mysql
db_database=laravel
db_username=root
Db_password=tanteng
db_port=8889
The temporary modification is to change the db_host there to localhost:8889, that is, add the port number, and then use the Laravel5 Artisan command to perform the migrate operation, but the operation is changed back to the previous wording, Otherwise the site front page will not open the database, prompt error: sqlstate[hy000] [Unknown] MySQL server Host ' localhost:8889 ' (0)
Well, this solves the problem of using the Laravel5 migrate error.
Turn from: Small Talk blog Http://www.tantengvip.com/2015/12/laravel-migrate-mysql-2000/
More interested in laravel related content readers can view the site topics: "Laravel Framework Introduction and Advanced Course", "PHP Excellent Development Framework Summary", "Smarty Template Primer Tutorial", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course ", PHP string (String) Usage summary," PHP+MYSQL Database operation Introduction Tutorial "and" PHP common database Operation Skills Summary "
I hope this article will help you with the PHP program design based on Laravel framework.