-
Notifications
You must be signed in to change notification settings - Fork 64
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
backpack:crud-controller throw SQL error #156
Comments
Hello there! Thanks for opening your first issue on this repo! Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that. Backpack communication mediums:
Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch. Thank you! -- |
Hello @nioumaxime I am afraid I was not able to replicate your issue. I tried in mysql 8 and 5.7 too. From a quick google search I found this: https://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory Could be related with your problem. Let me know how it goes. Cheers |
Hum yes, thanks @pxpm it worked, changing to 127.0.0.1 and adding a unix_socket did the trick. By the way is there any reason why using 127.0.0.1 over localhost isn't more encouraged ? |
@nioumaxime I am not a devops expert, but I think it has to do with machine name resolution or something similar. Using localhost will force your mysql instance to use the unix socket, if it's not on the "default" location, it will fail. Glad it's solved! 🙏 Cheers |
Bug report
What I did:
Create a new project, after setting up database (both in my .env file and database.php) and playing a bit with the admin panel i tried to run php artisan backpack:crud MyDBTable but it throw an error when trying to create the CrudController :
SQLSTATE[HY000] [2002] No such file or directory (SQL: select column_name as 'column_name' from information_schema.columns where table_schema = MyDBName and table_name = MyDBTable)
even though DB connection works fine if i create everything manually and test it out in my admin panel
What I expected to happen:
Generating Model, CrudController, Route, ...
What happened:
Error thrown after Model is created when trying to generate CrudController
SQLSTATE[HY000] [2002] No such file or directory (SQL: select column_name as 'column_name' from information_schema.columns where table_schema = MyDBName and table_name = MyDBTable)
What I've already tried to fix it:
select column_name as 'column_name' from information_schema.columns where table_schema = 'MyDBName' and table_name = 'MyDBTable'
php artisan backpack:crud-controller MyDBTable then generating the rest with php artisan backpack:crud MyDBTable works (just throw a warning than CrudController already exist which is logic since i just created it)
Backpack, Laravel, PHP, DB version:
"backpack/crud": "^5.3",
"backpack/pro": "^1.2",
"laravel/framework": "^9.19",
"backpack/generators": "^3.2",
PHP : 8.0.8
MYSQL : 5.7.34
The text was updated successfully, but these errors were encountered: