Jump to content
Sign in to follow this  
smus

Laravel 5.5 connection to MySQL

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.