PHP 7.3 + Mysql 8 Connection issue?
This blog is going to be a small one. But it will definitely fix the issue which many of us are facing. First thing is you would require MySQL WorkBench. Download it for free from MySQL website. Make sure you download the workbench 8 for the MySQL 8. Once that is done, considering you already have MySQL 8 installed on your server, I will let you know how to fix the mysqliconnect.
Main issue is the Authentication type of the MySQL User. By Default when you use Root or create a user in MySQL 8 it will set your password of the type caching_sha2_password. So instead of going to change this type for the current users, we will create new Users.
Open MySQL Workbench 8. Connect your MySQL 8 with the root or already defined password. Workbench should work with the caching_sha2_password. So you can login using that. Once you are done with that.
Under the “Administration” tab look for “Users and Privileges”. This option will give you freedom to add or edit current users. However we can’t change the Authentication type of users which are already set. So we create a new User with new details. But setting the Authentication Type to Standard. That’s it then you should be able to connect using the MySqliconnect in PHP 7.3 . Other then this inside your Workbench you can give the user permissions like Schema Privileges.
That’s it. So bottom line is create a new user in Mysql 8 with authentication type “Standard” and you can connect to it. Ofcourse if you guys know the Command line approach to create user, you can do that as well.