Error connecting MySQL 8 database

Error connecting MySQL 8 database

In this tutorial, we will see how to connect to a MySQL database that prohibits access when you have PHP 7 with MySQL 8.





First, you must follow the manual Creating a new MySQL User.


1- Once the creation of the new user has been done, you must go to the path to edit the MySQL configuration file.

Windows: C:\ProgramData\MySQL\MySQL Server[VERSION_HERE]\ my.ini,
OBS: The ProgramData folder is a hidden folder, in order to see it you must access the option Folder > Show hidden files and folders.
Linux: /etc/mysql/my.cnf

2- Then edit the file and where it says 

default-authentication-plugin = caching_sha2_password.

Change to

default-autenticaĆ§Ć£o-plugin = mysql_native_password


If you don't find the line above, add this snippet:

[mysqld]
 default_authentication_plugin= mysql_native_password

 
 Finally, restart the MySQL service in order to enable the new settings.


    • Related Articles

    • How to connect to MySQL 8.0

      The MySQL 8 uses a different authentication from your predecessors, that until the moment it's not accepted by PHP 7, that generates the error "The server requested authentication method unknown to the client" at connecting to Scriptcase. First, you ...
    • Connection error: error_profile_test_module

      When we deploy a project and we find this type of error: "Connection error: error_profile_test_module" This error normally occurs when you use a different production environment DBMS Type than the development environment. To solve this, access your ...
    • Correcting access error for the Scriptcase database

      Sometimes we encounter an error accessing the Scriptcase database itself, as shown in the image below:   This problem happens when we change the folder name of the scriptcase to another name, such as "sc". Then, the error happens because the complete ...
    • Connecting with Firebird on Windows - PHP 7.3

      If you are using a manual installation on Windows, you will need to enable the Firebird extensions in the php.ini file. See below for how to do this. 1 - In the `php.ini` file uncomment the line for the Firebird extension php_pdo_firebird by removing ...
    • 'No tables found in database access' error while trying to import Access data.

      This error occurs because it is necessary to have the Microsoft Access Database Engine installed, which contains a series of components that facilitate the transfer of information between files of Office for the other applications. For the ...