Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel php artisan migrate

When I run php artisan migrate

In Connection.php line 664:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = aviandb and table_name = migrations)

In Connector.php line 68:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

In Connector.php line 68:

PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

How can I solve?

like image 880
Alfredo Arabia Avatar asked Jun 22 '18 19:06

Alfredo Arabia


People also ask

What does php artisan migrate?

php artisan migrate publishes all our schema to the database. This command also creates the table in the database. php artisan migrate:status checks the status of the migration. migrate:status checks the migrations we have run.

What is php artisan migrate rollback?

By default, php artisan migrate:rollback will rollback all of your database migrations. By specifying --step=1 , you're saying that you only want to rollback the latest database migration. Plus, if you change the number, e.g. into --step=2 , you're telling Laravel to only rollback the last two migrations.

Which artisan command is used to migrate a database?

To create a new migration, you can run the make:migration Artisan command and that will bootstrap a new class on your Laravel application, in the database/migrations folder. This class will contain a default boilerplate code.

What is migrate command in Laravel?

Migrations are like version control for your database, allowing a team to easily modify and share the application's database schema. Migrations are typically paired with Laravel's schema builder to easily build your application's database schema.


2 Answers

Your php mysql extension doesn't support the version of MySQL server you are running.

I'm assuming you're running MySQL 8.0, which is new at the time of this post.

You need to update or rebuild PHP with support for the latest version of MySQL, or downgrade your MySQL Server version.

Another solution is to create a user with the mysql_native_password option.

CREATE USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
like image 143
Devon Avatar answered Sep 19 '22 01:09

Devon


Run this script on your query mysql and just your new password it will be work

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_password'
like image 39
Sam Avatar answered Sep 21 '22 01:09

Sam