Joomla and MySQL 8/nl: Difference between revisions

From Joomla! Documentation

Created page with "Vervang gebruikersnaam door de naam van het gebruikersaccount en wachtwoord door het wachtwoord dat bij het account hoort. Start MySQL opnieuw op en je bent klaar ... nou ja,..."
FuzzyBot (talk | contribs)
Updating to match new version of source page
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<noinclude><languages /></noinclude>
<noinclude><languages /></noinclude>
==MySQL default authentication plugin issue==
==MySQL default authentication plugin issue==
It's not possible to connect to a MySQL 8 Database using Joomla 3.8, 3.9 or 4.0. The reason is that MySQL 8 has a lot of changes under the hood. One change that affects Joomla is the default authentication plugin which is <tt>sha256_password</tt> instead of <tt>mysql_native_password</tt>. The native PHP MySQL-Driver don't support MySQL 8 with this plugin yet other programming languages like GO or PERL are struggling too. [https://github.com/php/php-src/commit/d6e81f0bfd0cb90586dd83d4fd47a4302605261a PHP 7.3 (alpha)] is supporting MySQL 8 though.  
It is possible to connect to a MySQL 8 Database using Joomla {{JVer|3.x}}, however it requires a customisation on the MySQL 8 installation configuration. The reason is that MySQL 8 has a lot of low-level changes including the default authentication plugin changing to <tt>sha256_password</tt> from <tt>mysql_native_password</tt>. The native PHP MySQL-Driver doesn't currently support MySQL 8 with this plugin. [https://github.com/php/php-src/commit/d6e81f0bfd0cb90586dd83d4fd47a4302605261a PHP 7.3 (alpha)] is supporting MySQL 8 though.  


==Workaround to get Joomla working with MySQL 8==
==MySQL configuration change to get Joomla working with MySQL 8==
Fortunately there is a workaround! We can use the <tt>mysql_native_password</tt> default authentication plugin for MySQL.
If you edit the configuration file for MySQL 8, you can change the default authentication plugin for MySQL to use the older mysql_native_password.
We need to open our configuration file <tt>sudo nano /etc/my.cnf</tt> (Please note that your file may be under a different directory) and add the following configuration:  
Open your configuration file <tt>sudo nano /etc/my.cnf</tt> (Please note that your file may be under a different directory) and add the following configuration:  
<source lang="ini">
<source lang="ini">
[mysqld]
[mysqld]
Line 15: Line 15:
</source>  
</source>  
Vervang gebruikersnaam door de naam van het gebruikersaccount en wachtwoord door het wachtwoord dat bij het account hoort. Start MySQL opnieuw op en je bent klaar ... nou ja, alleen als Joomla 3.8 of 3.9 is geïnstalleerd.
Vervang gebruikersnaam door de naam van het gebruikersaccount en wachtwoord door het wachtwoord dat bij het account hoort. Start MySQL opnieuw op en je bent klaar ... nou ja, alleen als Joomla 3.8 of 3.9 is geïnstalleerd.
Als je met Joomla! 4.0 wilt werken, moet je wat extra werk doen, omdat het beheerdersdashboard leeg is na de installatie met Joomla! 4.0 en MySQL 8.
Fortunately there is a fix for that too!
MySQL 8 is returning <tt>Incorrect date value: '0000-00-00'</tt> after running following insertion from the installation file <tt>/installation/sql/mysql/joomla.sql</tt>.
The following query must be run to fix this. Replace #_ with your table prefix.
<source lang=sql>
UPDATE `#__modules` SET `checked_out_time` = '1000-01-01 00:00:00', `publish_up` = '1000-01-01 00:00:00', `publish_down` = '1000-01-01 00:00:00';
</source>
This is happening because since MySQL 5.7, MySQL stops supporting zeros value in date / datetime.


==How MySQL default authentication plugin works==
==How MySQL default authentication plugin works==

Latest revision as of 19:56, 20 May 2021

MySQL default authentication plugin issue

It is possible to connect to a MySQL 8 Database using Joomla Joomla 3.x, however it requires a customisation on the MySQL 8 installation configuration. The reason is that MySQL 8 has a lot of low-level changes including the default authentication plugin changing to sha256_password from mysql_native_password. The native PHP MySQL-Driver doesn't currently support MySQL 8 with this plugin. PHP 7.3 (alpha) is supporting MySQL 8 though.

MySQL configuration change to get Joomla working with MySQL 8

If you edit the configuration file for MySQL 8, you can change the default authentication plugin for MySQL to use the older mysql_native_password. Open your configuration file sudo nano /etc/my.cnf (Please note that your file may be under a different directory) and add the following configuration:

[mysqld]
default-authentication-plugin=mysql_native_password

If you don't have access to your config file then you can update your user as follows:

ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Vervang gebruikersnaam door de naam van het gebruikersaccount en wachtwoord door het wachtwoord dat bij het account hoort. Start MySQL opnieuw op en je bent klaar ... nou ja, alleen als Joomla 3.8 of 3.9 is geïnstalleerd.

How MySQL default authentication plugin works

Het voordeel vanmysql_native_passwordis dat het het challenge-response-mechanisme ondersteunt dat erg snel is en geen gecodeerde verbinding vereist. mysql_native_password is echter afhankelijk van het SHA1-algoritme en NIST heeft aanbevolen het gebruik te stoppen.

Verder, als twee gebruikers hetzelfde wachtwoord gebruiken,mysql_native_passwordtransformatie is hetzelfde in de mysql.user table. Hoewel de hash geen informatie laat zien van het huidige wachtwoord, het zegt wel welke twee gebruikers hetzelfde wachtwoord gebruiken. Om dat te voorkomen moet een salt gebruikt worden. Een salt is in feite een willekeurig getal dat wordt gebruikt als een van de parameters voor cryptografische hashfuncties die worden gebruikt om gebruikerswachtwoorden te transformeren. Aangezien een salt willekeurig en verschillend is voor elke uitvoering, zelfs als twee gebruikers dezelfde wachtwoorden gebruiken, zou het eindresultaat van de transformatie er heel anders uitzien. Since MySQL 5.6, sha256_password authentication plugin is supported. It uses multiple rounds of SHA256 hash on a salted password to make sure that the hash transformation is more secure. However, it requires either encrypted connections or support for an RSA key pair. So, while password security is stronger, secure connections and multiple rounds of hash transformations require more time in the authentication process.

caching_sha2_password tries to combine the best of both worlds. [1]