smus Posted October 17, 2017 Share Posted October 17, 2017 I am quite new to Laravel(ver 5.5). There is an error while I am trying to create a table in an existing database: Illuminate\Database\QueryException thrown with message "SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: create table `books` (`id` int unsigned not null auto_increment primary key, `writer` varchar(255) not null, `title` varchar(500) not null, `description` text not null, `published` date not null, `copies` int not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8 collate utf8_unicode_ci)" This is config/database.php file: 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'mfa'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', 'mypass'), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ], .env: APP_NAME=Laravel APP_ENV=local APP_KEY=base64:Pf8bqFhStKix4rtdt1FOgvPpudMqsYyw+Uv+dOvaF8w= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=mfa DB_USERNAME=root DB_PASSWORD=mypass BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= I have changed both files to adjust to my DBName, UserName and PassWord Quote Link to comment https://forums.phpfreaks.com/topic/305378-laravel-55-connection-to-mysql/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.