Open raffanugraha17 opened 7 months ago
Do you have a localhost server running?
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as
name
, (data_length + index_length) assize
, table_comment ascomment
, engine asengine
, table_collation ascollation
from information_schema.tables where table_schema = 'kasir' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ }
+39 vendor frames
40 artisan:35 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
If i run command php artisan migrate --seed on my visual studio code terminal it turns like this. How to solve it?
bro replace your .env file with this copy below the lines of ENV variables and past it in your.env file
APP_NAME="Triangle POS" APP_ENV=local APP_KEY=base64:3wENLMQP7UNWWSii7ja1TTLO1J4hjKxBCyqk40aP8EM= APP_DEBUG=true APP_URL=http://localhost:8000/
DEBUGBAR_ENABLED=false
LOG_CHANNEL=stack LOG_LEVEL=debug
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=triangle_pos DB_USERNAME=root DB_PASSWORD=
BROADCAST_DRIVER=log CACHE_DRIVER=file FILESYSTEM_DRIVER=local QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379
MAIL_MAILER=smtp MAIL_HOST=mailhog MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Check Your .env File Ensure that your database connection settings in the .env file are correct. Your .env file should contain entries like these:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=kasir
DB_USERNAME=root
DB_PASSWORD=
DB_HOST: Should be 127.0.0.1 or localhost if your MySQL server is running on the same machine. DB_PORT: Default MySQL port is 3306. DB_DATABASE: Should be the name of your database, which seems to be kasir. DB_USERNAME and DB_PASSWORD: Should be your MySQL username and password.
On Linux:
sudo service mysql start
On macOS with Homebrew:
brew services start mysql
On Windows, use the Services application to start the MySQL service or use the command line:
net start mysql
Check MySQL Socket If you're on a Unix-based system and the error persists, it might be related to the MySQL socket file. You can find the socket file location in your MySQL configuration (usually my.cnf or my.ini). Make sure that the DB_SOCKET setting in the .env file matches the MySQL socket file location, or if you're using a default MySQL socket file path.
Verify MySQL Credentials Make sure that the MySQL credentials (username and password) used in the .env file are correct and have the necessary permissions to access the kasir database.
Clear Configuration Cache Sometimes Laravel caches the configuration settings. Clear the configuration cache by running:
php artisan config:clear
Check for Typos Ensure there are no typos in your .env file or any configuration files related to the database.
Restart Your Development Environment Sometimes, simply restarting your development environment or server can resolve connection issues.
After checking and correcting these settings, try running the migration command again:
php artisan migrate --seed
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as
name
, (data_length + index_length) assize
, table_comment ascomment
, engine asengine
, table_collation ascollation
from information_schema.tables where table_schema = 'kasir' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ }
40 artisan:35 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
If i run command php artisan migrate --seed on my visual studio code terminal it turns like this. How to solve it?