Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Migration fails, no such file or directory #66

Closed
jackmcdade opened this issue Jan 16, 2013 · 10 comments
Closed

[Bug] Migration fails, no such file or directory #66

jackmcdade opened this issue Jan 16, 2013 · 10 comments

Comments

@jackmcdade
Copy link

I can run the Schema builder manually and everything works just fine. Example:

Schema::create('users', function($table)
{
    $table->increments('id');
});

But when using the Artisan Migrate command, I get the following error:

[PDOException]                                    
SQLSTATE[HY000] [2002] No such file or directory  

[ErrorException]                                                                                                                                                                  
Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /path/to/laravel/vendor/laravel/framework/sr  
  c/Illuminate/Database/Connectors/Connector.php line 47                                                                                                                                                                       
@jackmcdade
Copy link
Author

False alarm, was a MAMP issue. For anyone else with the problem, this took care of it:

http://www.reecefowell.com/2012/07/21/symfony2-cli-does-not-connect-to-mysql-while-browser-works-fine/

@hnordt
Copy link

hnordt commented Jun 20, 2013

Thank you! This works for me. 👍

@swt83
Copy link

swt83 commented Jul 30, 2013

I'm not using MAMP but having this same issue. In my case I'm trying to run a task via exec() in a faux-fork technique. Not sure what I should do to fix this issue.

@crloscstillo
Copy link

I ran into the same problem by running migrations using MySQL. Apparently it's just a matter of using "127.0.0.1" instead of "localhost". http://stackoverflow.com/questions/6259424/troubleshooting-no-such-file-or-directory-when-running-php-app-console-doctri

@itjoo
Copy link

itjoo commented Oct 5, 2014

i have migration file 'user' and becuase this is similar model class i delete this file. . afther that i have this error : include(/var/www/html/myfirstproject/app/database/migrations/2014_10_05_170254_user.php): failed to open stream: No such file or directory
how i can fix this??

@khanhth
Copy link

khanhth commented Oct 7, 2014

@itjoo it's because your autoload_classmap.php file containing your old deleted file. Just update it or simply run composer dump-autoload

@MartinGacheru
Copy link

Thanks @petwho very helpful !

@maaeyeng
Copy link

maaeyeng commented Aug 1, 2020

This error on laravel i'm using command php artisan migrate
Illuminate\Database\QueryException

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = schoolSYS and table_name = migrations and table_type = 'BASE TABLE')

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {

671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|

  +34 vendor frames 

35 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

@daviidy
Copy link

daviidy commented Mar 9, 2021

This error on laravel i'm using command php artisan migrate
Illuminate\Database\QueryException

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = schoolSYS and table_name = migrations and table_type = 'BASE TABLE')

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {

671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|

  +34 vendor frames 

35 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants