- Laravel Framework 5.8.35
- MySQL 8.0.17
- Vue 2.5.17
- vue-axios 2.1.5
I read and corrected some articles about authentication methods for MySQL8. By the way, I've made some apps using MySQL and Laravel so far.
// .env
DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_DATABASE = Database name (confirmed)
DB_USERNAME = tsubasa (confirmed)
DB_PASSWORD = Password (confirmed)
→ This works with Sequel pro, so there seems to be almost no mistake in connection.
>SELECT user, host, plugin FROM mysql.user;
+ ------------------ + ----------- + ------------------ ----- +
| user | host | plugin |
+ ------------------ + ----------- + ------------------ ----- +
| forge |% | caching_sha2_password |
| forge1 |% | caching_sha2_password |
| tsubasa |% | mysql_native_password |
| banana | localhost | caching_sha2_password |
mysql.infoschema | localhost | caching_sha2_password |
mysql.session | localhost | caching_sha2_password |
mysql.sys | localhost | caching_sha2_password |
| root | localhost | caching_sha2_password |
+ ------------------ + ----------- + ------------------ ----- +
I know that it's not good if it's not mysql_native_password, so it is currently only used by tsubasa users.
When you access http://127.0.0.1:8000/api/songs (use Vue, use/api /)
SQLSTATE [HY000] [2054] The server requested authentication method unknown to the client (SQL: select * fromsongs
)
will appear.
Similarly, even if you have a post relationship, there is no doubt that i am stuck with the same authority.
Possible causeAt the bottom of the image,
PDOException: :( "PDO :: __ construct (): The server requested authentication method unknown to the client [caching_sha2_password]")
/Users/tsubanana/Downloads/program/utakan/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO :: __ construct ("mysql: host = 127.0.0.1;port = 3306;dbname = laravel", "root", "", [])
/Users/tsubanana/Downloads/program/utakan/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
is displayed.
The client [caching_sha2_password] is also written asmysql_native_password
The second point "mysql: host = 127.0.0.1;port = 3306;dbname = laravel", "root" seems to be the default setting, but the user name is set to tsubasa etc. .
I saw Connector.php: 70, which is an error file to fix this, but it seems to be a variable and I can't figure out where to go. .
In other words, there seems to be another .env existence that has been reflected.
I'd be happy if you could teach me somebody.
-
Answer # 1
Related articles
- i want to change the user authentication method of mysql from chaching_sha2_password to mysql_native_password
- c # - authentication method when creating a gmail client with gmail api
- mysql 8020 installation and configuration method graphic tutorial under docker
- vba display method according to the number of input cells
- Configuration method of MySQL master-slave replication under Windows
- about laravel authentication method
- mysql - grouped according to the contents of the related table
- mysql conditional query and or use method and priority instance analysis
- how to start multiple servers on the same host in mysql8 and perform replication
- Detailed Django configuration JWT authentication method
- MySQL 8020 installation and configuration method graphic tutorials
- Multi-instance configuration method for MySQL database entry
- Win10 mysql 8020 installation and configuration method graphic tutorials
- MySQL 8020 winx64 installation and configuration method graphic tutorials
- mysql workbench step-by-step connection method
- mysql - about data extraction method
- mysql 8020 installation and configuration method graphic tutorial under window10
- i want to access mysql in aws rds through ssh authentication with mysqlclient in python
- Detailed implementation method of mysql cumulative calculation
- after changing the mysql authentication plugin, i can no longer log in
- i deployed the laravel + mysql + vue app on heroku, but i get a 500 error in the api part
- php - i don't know how to display an existing database in vue with laravel + mysql + vuejs
- php - non-root pages become not found in laravel nginx
- i want to make an application that can easily search spanish verb conjugation with vuejs + laravel + mysql
- php - laravel can't access local mysql
.env has been modified so we have to do config: cache but forgot.
In other words, it seems better not to do it outside the production environment. Please check for details.
https://blog.capilano-fw.com/?p=3343