Laravel Execute migrate command prompt: No such file or directory workaround, laravelmigrate_php tutorial

Source: Internet
Author: User
Tags smarty template

Laravel Execute migrate command prompt: No such file or directory resolution, laravelmigrate


This example describes the Laravel execution migrate command prompt: No such file or directory workaround. Share to everyone for your reference, as follows:

Use the Laravel command line tool today to operate the database migration operation times wrong, prompt MySQL 2002 error,

View database Configuration Yes, the website front desk can also open, explain can connect, that is what reason?

In Laravel5, there are two ways to solve the problem:

1. Add a Database configuration item

' 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 additions here is unix_socket, native Mac-mounted MAMP environment, path is/applications/mamp/tmp/mysql/mysql.sock, the way to view your own path is to enter the following command in MySQL to see:

Show variables like '%sock% ';

As shown in the following:

2. Modify the. Env Configuration

This method can only be modified temporarily, let migrate can execute, then must change back.

db_host=localhostdb_connection=mysqldb_database=laraveldb_username=rootdb_password=tantengdb_port=8889

Temporary modification method is to change the db_host there to localhost:8889, that is, the port number plus, and then use the Laravel5 Artisan command to perform the migrate operation can be, but the operation is done to change back to the previous wording, Otherwise the site front page will not open to the database, prompt error: sqlstate[hy000] [2005] Unknown MySQL Server Host ' localhost:8889 ' (0)

Well, this solves the problem of using Laravel5 's 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 this site topic: "Laravel Framework Introductory and Advanced tutorial", "PHP Excellent Development Framework Summary", "Smarty Template Primer Basic Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming introduction tutorial "," PHP String Usage Summary "," Introduction to Php+mysql Database Operations "and" PHP common database Operation Skills Summary "

It is hoped that this article is helpful to the PHP program design based on Laravel framework.

Articles you may be interested in:

    • PHP's Laravel framework combined with MySQL and Redis database deployment
    • Methods for using Message Queuing queue and asynchronous queues in PHP's Laravel framework
    • A detailed example of trait usage in Laravel
    • Steps to register facades in Laravel
    • Laravel method of implementing automatic dependency injection of constructors
    • Laravel ways to reduce database query pressure using caching cache data
    • Create an App interface (API) based on Laravel
    • Eloquent Object relational mapping in PHP's Laravel framework using
    • Laravel Framework Database curd operation and coherent operation summary
    • In-depth parsing of event events operations in PHP's Laravel framework

http://www.bkjia.com/PHPjc/1111344.html www.bkjia.com true http://www.bkjia.com/PHPjc/1111344.html techarticle laravel Execute migrate command prompt: No such file or directory workaround, Laravelmigrate This example describes laravel Execute migrate command prompt: No such file or Directory resolution ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.