can someone help me after i run the composer install - laravel

config file
enter image description here
#my appService provider
enter image description here
can someone tell me about this problem after I input composer install that problem says and now I cant migrate
[Illuminate\Database\QueryException] Database (C:\xampp\htdocs\shop2\database\db.sqlite) does not exist. (SQL: PRAGMA foreign_keys=1)
when I run php artisan migrate this problem show
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php' (SQL: select * from information_schema.tables where t
able_schema = config/database.php and table_name = migrations)
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php'
[PDOException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php'

Create an empty file with name of db.sqlite in your database folder of the app. Then, run php artisan migrate, It will be filled by the app.

Related

Error connecting to database through Docker

I have a mysql service running on port 3308 using docker. However on table plus when I try to access this using “127.0.0.1” as the Host and Port “3308”, enter the user, password and database name if I test the connection it shows an error:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Also If I run php artisan migrate I get:
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = project and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
If I use the port 3306 on tableplus I can connect to the database but still get the issue with the php artisan command. But it's strange because in docker is configured with port 3308.
The .env file is like this:
DB_CONNECTION=mysql
DB_HOST=host.docker.internal
DB_PORT=3308
DB_DATABASE=project
DB_USERNAME=root
DB_PASSWORD=pass
Do you know what can be the issue?
Are both container, php-fpm and the database-service-container, in the same network? Did you change the database config in .env? The config parameter DB_HOST should not show an ip, instead set it to the name of your mysql container/Service. Eg.G DB_HOST=database

Lumen, laravel and pgsql SQLSTATE[HY000] [2002] No such file or directory

I was created rest API with Lumen and pgsql in my localhost then its running perfect when I test to call my API with postman, then I run php artisan migrate on server production in cloud and run success. But when I call my API in cloud it show error like this
{
"code": "500",
"message": "SQLSTATE[HY000] [2002] No such file or directory (SQL: select `id`, `payment` from `myDb` where `client_id` = xxxxx and `client_secret` = xxxxxxx limit 1)",
"data": null
}
Please someone can help me.
Thanks advance

SQLSTATE[HY000] [1698] Access denied for user 'hadi'#'localhost'

currently I install laravel 8 in my Linux operating system without any error, so I started working on a simple blog-post application, and when I run php artisan migrate I get the following error.
Illuminate\Database\QueryException
SQLSTATE[HY000] [1698] Access denied for user 'hadi'#'localhost' (SQL: select * from information_schema.tables where table_schema = blog 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()
I search for my problem here and other sites but I can't find an exact solution.
Hope to get one
Check your file .env. Make sure its correctly.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
In case, you put correct credential but it still not work you can:
Delete Cache Files From root/boostrap/chache/files and Run The App

Cant find migrations table when trying to migrate table in laravel

Im new to laravel and im trying to run php artisan migrate but im getting this error
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that cor responds to your MariaDB server version for the right syntax to use near '-DYNAM IC' at line 1 (SQL: create table `migrations` (`id` int unsigned not null auto_i ncrement primary key, `migration` varchar(191) not null, `batch` int not null) d efault character set utf8mb4 collate utf8mb4_unicode_ci engine = InnoDB ROW_FORM AT-DYNAMIC)
also mentioning that my database is empty and have no tables, and i had tried to run php artisan migrate:rollback or reset but the console is telling me that no migrations where found
run php artisan migrate:install it will solve the problem

in facade.php 221, call to undefined method MySqlBuilder::defaultStringLenght()

in windows command promt full eror it gives same with some php artisan commands
C:\xampp\htdocs\jj>php artisan migrate
In Connection.php line 664:
SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal' (SQL: select * from information_schema
.tables where table_schema = juwelleryjournal and table_name = migrations)
In Connector.php line 67:
SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal'
, & php artisan make:"blabla" works well
If you encounter same error, latest windows php version could be an option for you, but it helped only my classmate, not me. The i found on already being in stack overflow (Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLength()) and didn't help either. This occurs same on laptop(win7) and desktop pc(win10). I have laravel5.5.28 on both.
Have anyone any suggestions?
Add this to your AppServiceProvider
use Illuminate\Support\Facades\Schema;
function boot()
{
Schema::defaultStringLength(191);
}
Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLenght()
=> the method name is wrong, it should be defaultStringLength

Resources