I try to rollback my database system with
php artisan migrate:rollback --database='system'
but it seem the doen't work like the migreation php artisan migrate --database='system
can't you help me found what going on.
here my config/database.php
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '4444'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'system' => [
'driver' => 'mysql',
'host' => env('SYSTEM_DB_HOST', 'localhost'),
'port' => env('SYSTEM_DB_PORT', '4444'),
'database' => env('SYSTEM_DB_DATABASE', 'forge'),
'username' => env('SYSTEM_DB_USERNAME', 'forge'),
'password' => env('SYSTEM_DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
this is my .env file.
#-----------------------------------------------------
# CLIENT DB CONNECTION
#-----------------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=databaseNameClient
DB_USERNAME=homestead
DB_PASSWORD=secret
#-----------------------------------------------------
# SYSTEM DB CONNECTION
#-----------------------------------------------------
DB_CONNECTION=system
SYSTEM_DB_HOST=127.0.0.1
SYSTEM_DB_PORT=3306
SYSTEM_DB_DATABASE=databaseNameSystem
SYSTEM_DB_USERNAME=homestead
SYSTEM_DB_PASSWORD=secret
this is the message error i got when i try migration:rollback --database='system' :
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Database\Schema\MySqlBuilder::dddconnection()
the last lines for my stack trace are:
#23 /vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 {main}
[2018-04-17 00:51:07] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Database\Schema\MySqlBuilder::dddconnection() in /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:217
You have accidently changed the methods in vendor folder.
Step 1.
delete the vendor folder.
Step 2.
run
composer install
It will install all the libraries again and overwrite changes.
Hope this helps
It's quite difficult to say without looking at full error log, but there is alternate for this, if you create down methods for your migration by providing specific database connection like this
Schema::connection('mysql2')->create('some_table', function($table)
{
$table->increments('id'):
});
Then only php artisan migrate:rollback will work perfectly for this.
If you look in your migrations table, then you’ll see each migration
has a batch number. So when you roll back, it rolls back each
migration that was part of the last batch.
If you only want to roll back the very last migration, then just
increment the batch number by one. Then next time you run the rollback
command, it’ll only roll back that one migration as it’s in a “batch” of
its own.
for more follow the url :
Rollback one specific migration in Laravel
Hi thanks your all to take your time to answered my question. I found what going on. In one ove my migration, in the down function I have a function was misspelled
public function down()
{
if (Schema::dddconnection('system')->hasTable('apiservices_categories_translations')) {
Schema::connection('system')->dropIfExists('apiservices_categories_translations');
}
}
Related
The problem
I am using Laravel 8.83.23
I have schema dump from squashed migrations in database\schema\mysql-schema.dump
tests are running above test database, as in database.php
'testing' => [
'driver' => 'mysql',
'host' => env('DB_TEST_HOST', '127.0.0.1'),
'port' => env('DB_TEST_PORT', '3306'),
'database' => env('DB_TEST_DATABASE', 'forge'),
'username' => env('DB_TEST_USERNAME', 'forge'),
'password' => env('DB_TEST_PASSWORD', ''),
],
Before I squashed migrations, my test cases only used DatabaseMigrations trait, and the test database was recreated every time and all worked, example of test class:
class SystemControllerTest extends TestCase
{
use WithFaker;
use DatabaseMigrations;
/**
* #var User
*/
private $user;
public function setUp(): void
{
parent::setUp();
//create roles and data
$this->seed(RoleAndPermissionSeeder::class);
... etc
the migrations were found and executed, recreating the database
then, I squashed the migrations, so all migrations got deleted, and I got database\schema\mysql-schema.dump
php artisan migrate works as expected through command line, creating full database schemas from the dump (it finds it)
tests however no longer work, as there is an error
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cinema_test.roles' doesn't exist (SQL: delete from `roles`)
when I check the sql test database after the test runs, it is empty (only table migrations gets created there, and it is empty)
this error persists even when I call artisan migrate in the test's setup:
public function setUp(): void
{
parent::setUp();
Artisan::call('migrate', array(
'--database' => 'testing',
'--force' => true));
//it crashes here
$this->seed(RoleAndPermissionSeeder::class);
RoleAndPermissionSeeder just operates with the sql tables, which do not exist, hence the error
I even tried DatabaseMigrations and DatabaseTransactions and RefreshDatabase traits, without any success
how do I populate the database data? There is no way for me to read the output of the Artisan::call('migrate') command, so I do not know what is happening there
return code of Artisan::call('migrate') is 0
is there maybe some setup I am missing?
I have finally figured this out.
The reason for the problem
The problem was in incorrect setup of the testing environment. I have not discovered the exact reason, but I figured out how to setup the testing environment so that the dump would be found and loaded.
How I hunt down the bug
This describes my steps on how I found a way to fix this.
In database.php I have copied testing database instead of normal one
in database.php I had the main database connection:
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
and the testing connection
'testing' => [
'driver' => 'mysql',
'host' => env('DB_TEST_HOST', '127.0.0.1'),
'port' => env('DB_TEST_PORT', '3306'),
'database' => env('DB_TEST_DATABASE', 'forge'),
'username' => env('DB_TEST_USERNAME', 'forge'),
'password' => env('DB_TEST_PASSWORD', ''),
],
I copied the testing connection data into a new mysql connection, just to see, whether on a command line I get same results
so, the file then looked like this
'mysql' => [
'url' => env('DATABASE_URL'),
'driver' => 'mysql',
'host' => env('DB_TEST_HOST', '127.0.0.1'),
'port' => env('DB_TEST_PORT', '3306'),
'database' => env('DB_TEST_DATABASE', 'forge'),
'username' => env('DB_TEST_USERNAME', 'forge'),
'password' => env('DB_TEST_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
/*'testing' => [
'driver' => 'mysql',
'host' => env('DB_TEST_HOST', '127.0.0.1'),
'port' => env('DB_TEST_PORT', '3306'),
'database' => env('DB_TEST_DATABASE', 'forge'),
'username' => env('DB_TEST_USERNAME', 'forge'),
'password' => env('DB_TEST_PASSWORD', ''),
],*/
on the console, I ran php artisan:migrate
the database dump was found and loaded
therefore, the dump was found in normal cases, but was not found, in testing cases
after some research, I changed the testing environment setup in phpunit.xml, I will explain it now
The file phpunit.xml
The phpunit.xml was as follows (not full file shown here):
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
so, we can see that the testing database connection is defined for unit tests
on web I found advice to set the database table only, instead of changing entire connection for tests, because it is easier
I tried such an approach, so the phpunit.xml became
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
<env name="DB_DATABASE" value="cinema_test"/>
</php>
</phpunit>
I deleted the testing connection from database.php and related obsolete variables from .env file
this fixed the issue, and the dump file got loaded even in tests now
Conclusion
Although I have not figured out the real cause for the lavavel not loading the dump file, I have found a workaround which was to only change the database name for tests, instead of defining entirely new sql connection for testing pursposes. This solved the issue, and the database dump file gets loaded during tests now.
Seems like schema dumps can't be used for the in-memory database when testing
https://laravel.com/docs/9.x/migrations#squashing-migrations
May be able to do something like this
DB::unprepared(file_get_contents("path/file.sql"));
Would only try as a last resort, personally would want a test environment migration, also you should add a check for a test environment migration if you take this approach
I have updated a Laravel 5.5-installation to 5.8 and am now attempting to update the MySQL-installation from 5.7 to 8.0.19. The Laravel-installation is on an EC2-instance and works great with the previous RDS MySQL/Aurora installation, but the version did not cut it.
We are running this on an nginx-server.
First I got an error-message stating
(2/2) PDOException
SQLSTATE[HY000] [2002] Connection refused
Tried to change the AWS uri and use the ip instead, and got a 504 instead.
I tried to access the database through MySQL Workbench and through new PDO('mysql:host=xx-rds-staging-mysql-8.xxxxxxxxxxxx.eu-west-1.rds.amazonaws.com;port=3306;dbname=database', 'username', 'password', [0, 2, 0, false, false, false]) and... they both work perfectly from the EC2-instance.
Env-file:
DB_CONNECTION="mysql"
DB_HOST_WRITE="xx-rds-staging-mysql-8.xxxxxxxxxxxx.eu-west-1.rds.amazonaws.com"
DB_HOST_READ="xx-rds-staging-mysql-8.xxxxxxxxxxxx.eu-west-1.rds.amazonaws.com"
DB_PORT_READ_AND_WRITE="3306"
DB_DATABASE="database"
DB_USERNAME="username"
DB_PASSWORD="password"
config/database.php
'mysql' => [
'read' => [
'host' => env('DB_HOST_READ', '127.0.0.1'),
],
'write' => [
'host' => env('DB_HOST_WRITE', '127.0.0.1'),
],
'port' => env('DB_PORT_READ_AND_WRITE', '3306'),
'driver' => 'mysql',
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
'sticky' => true,
'version' => 8,
'modes' => [
#'ONLY_FULL_GROUP_BY',
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ENGINE_SUBSTITUTION',
],
'options' => [
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
],
],
I have cleared the cache by all the artisan-commands and by deleting the cache-folder.
I am rubbish at asking for help here, not ever certain what information I need to share to make my case.
My first thought is that there ought to be some setting in Laravel which I could swap to make this work, but I have no idea what it could be.
The mysql-server does not run on the same machine as the laravel-application and AWS has not offered a public ip, just the uri.
What makes it even stranger is that I can enter php artisan tinker and run, for example, User::first(); and it will fetch the appropriate row from the database, without any issue.
No details informaton but you can review below points:
Verify your Laravel/php config or connection file didn't change and have same settings as before.
Did you set any zone specific resstriction in RDS? Does your testing environment complies it?
How can I make sure that when I'm testing in Laravel with phpunit and for example I want to test my api route /test/1 it uses my test database?
I already made a test connection and changed my phpunit.xml file. I changed DB_CONNECTION to the test connection that I made.
<env name="DB_CONNECTION" value="mysql_testing"/>
But it when I make a post request I receive data from the development database?
In your Config/database.php file, what is the value of database in mysql_testing? It should be like this:
'mysql_testing' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('TEST_DB_DATABASE', 'db_testing'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
And database db_testing must exists.
Inside one of your test files, add the following to output your current DB_CONNECTION:
dd(env('DB_CONNECTION'));
You should get mysql_testing in your test output if PHPUnit.xml is properly setup.
Just tried to run artisan dump-autoload and came accross this:
{"error":{"type":"PDOException","message":"SQLSTATE[HY000] [2002] No such file or directory","file":"\/Applications\/MAMP\/htdocs\/blog\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Connectors\/Connector.php","line":47}}
Never seen that before and there is nothing I can think of that I have changed regarding the DB. For the record, all other Database functions are working fine.
EDIT: Simply running:
php artisan
also gives the same error.
Change the host name in your database config file app/config/database.php from localhost to 127.0.0.1, this should work.
If you're running Laravel on MAMP for MAC, you can fix it like this:
Edit database.php and add the following line inside 'mysql' connection:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
Example:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
I've installed laravel 5 successfully by using this command:
composer create-project laravel/laravel test-laravel-5-project dev-develop --prefer-dist
I even verified the version of installed laravel by using php artisan -V command. The output was
Laravel Framework version 5.0-dev
Then I went to app/config/database.php, gave dafault db as mysql and gave configurations as
'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'Logintestfive'), 'username'=> env('DB_USERNAME', 'root'), 'password'=> env('DB_PASSWORD', 'manasa'), 'charset'=> 'utf-8', 'collation'=> 'utf-8_unicode_ci', prefix=> '', 'strict'=> false, ]
Then I went to localhost:8000/auth/register and filled up the form and submitted the data and this is the error which I got:
PDOException in Connector.php line 47: SQLSTATE[28000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)
But I've neither used laravel homestead for installng laravel 5 in my system nor used vagrant to set up laravel homestead. And it tells me like this:
in Connector.php line 47
at PDO->__construct('mysql:host=localhost;dbname=homestead', 'homestead', 'secret', array('0', '2', '0', false, '0')) in Connector.php line 47
at Connector->createConnection('mysql:host=localhost;dbname=homestead', array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, '0')) in MySqlConnector.php line 20
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10545
at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10541
at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false), 'mysql') in compiled.php line 10459
How can I fix those issues?
I got a similar problem. I started my server using php artisan serve command, and edited the .env file and refreshed the web-page which did not reflect any changes!
I fixed it by stopping the webserver, editing the .env.php file and restarting the webserver!
So I guess it's a caching-issue of the .env.php file.
Laravel 5.1.10
As the answers already given above by Ganesh and Yordi, But i'm combining the both of them into single one.
Issue:
When i try to create a database in phpmyAdmin and want to create schema/table through Laravel Schema builder service i got the following errors:
PDOException in Connector.php line 50: SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)
in Connector.php line 50
at PDO->__construct('mysql:host=localhost;dbname=homestead', 'homestead', 'secret', array('0', '2', '0', false, '0'))
in Connector.php line 50
at Connector->createConnection('mysql:host=localhost;dbname=homestead', array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, '0')) in MySqlConnector.php line 22
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) .............
Solution 1:
Then I realised that the issues were in the env file, I forgot to change the values in the env file. The .env file is located in the laravel 5 root directory
open the file and change the following values with your ones
DB_DATABASE = localhost,
DB_USERNAME = databse-username,
DB_PASSWORD = databse-user-password
Solution 2:
Or change in the database.php file without env() as Ganesh syas:
// instead of this block
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'your database name'),
'username' => env('DB_USERNAME', 'your database username'),
'password' => env('DB_PASSWORD', 'your database password'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
// use this one
'mysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'your database name',
'username' => 'your database username',
'password' => 'your database password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]
The both solutions worked for me.
Laravel is using the variables contained in your .env file.
From: http://laravel.com/docs/master/configuration
It is often helpful to have different configuration values based on the environment the application is running in. For example, you may wish to use a different cache driver locally than you do on your production server. It's easy using environment based configuration.
Laravel utilizes the DotEnv PHP library by Vance Lucas. In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.
All of the variables listed in this file will be loaded into the $_ENV PHP super-global when your application receives a request. You may use the env helper to retrieve values from these variables. In fact, if you review the Laravel configuration files, you will notice several of the options already using this helper!
Feel free to modify your environment variables as needed for your own local server, as well as your production environment. However, your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration.
If you are developing with a team, you may wish to continue including a .env.example file with your application. By putting place-holder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application.
The default .env file looks something like:
APP_ENV=local
APP_DEBUG=true
APP_KEY=YOUR_KEY_HERE
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
I got the same problem. After I use the command "php artisan config:clear" to clear the old configuration cache file, it can work. Maybe you can try it.
By the way, my English is not good, hope you can understand.
Laravel is using .env file so change the .env file or change in the database.php file without env()
'mysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'your database name',
'username' => 'your database username',
'password' => 'your database password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]
In Config->database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'DBName'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
In .env file :
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=DBName
DB_USERNAME=root
DB_PASSWORD=
Close the laravel application server and restart again for clearing the cache.
php artisan serve
Or you can do :
php artisan config:clear
This will clear the cache in config files.
Now it will definitely work! Cheers!
Laravel config/database.php uses the .env file for database name,username asnd password, Please change your .env file
DB_HOST=localhost
DB_DATABASE=my_project
DB_USERNAME=root
DB_PASSWORD=myproject
After changing this run the below command:
composer dump-autoload
then run your project
php artisan serve
I had a very similar issue and didn't know where to look. I cleared the cache, restarted server, etc., no joy. Until I found it...
Before I reverted to a previous version on the Git repo, I used to have my session driver set to use the database! Silly thing, but it's not necessarily the database connection what you need to look at but instead where you are invoking the database to be used at the first place.
I hope that somebody who'll end up on this page the way I did will find this helpful.
i have same issui, edit file .env on root folder and change database config DB_DATABASE DB_USERNAME DB_PASSWORD
Inside your laravel eg. c:/www/laravel, create a new directory called 'local' inside app/config.Copy database.php (app/config/database.php).This works for me
Yes i had the same issues where everything went well right from migration installation to php artisan migrate. But when i tried to create a user the access denied.
Solution i found was to close the ctrl + d to terminate the server and restart. I worked... :)
you can restart your server
I think is a catch error in Laravel so run your server again with "php artisan serve" and refresh your website page IT's OK.
for me
sudo service apache2 reload
did the job