Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation Contao 4.9 und MAMP Pro schlägt fehlt wegen server_version #1631

Closed
contaoacademy opened this issue Apr 4, 2020 · 9 comments · Fixed by #1698
Closed

Installation Contao 4.9 und MAMP Pro schlägt fehlt wegen server_version #1631

contaoacademy opened this issue Apr 4, 2020 · 9 comments · Fixed by #1698

Comments

@contaoacademy
Copy link

Affected version(s)

  • Contao 4.9
  • MacOS Catalina
  • PHP 7.4
  • MAMP Pro 5.7

Description
Bei einer frischen Installation von Contao 4.9 über den Contao Manager bricht die Installation kurz vor Schluss ab. Problem ist wohl die Prüfung der Datenbankverbindung. (siehe Ausgabe)

Leider konnte ich bisher den Fehler nur bei 2 Kunden sehen, allerdings bei meinem eigenen System nicht nachvollziehen und reproduzieren.

Das Problem tritt erst seit Contao 4.9 auf.
Wenn Contao 4.4 installiert wird, läuft alles fehlerfrei durch.

Hier auch ein Beitrag im Forum zu diesem Problem.
https://community.contao.org/de/showthread.php?77266-Lokale-Installation-von-contao-4-9-in-MAMP-mit-php7-4-2-unvollst%C3%A4ndig-bricht-ab

Wie kann das Problem analysiert werden bzw. wie kann ich zur Fehlersuche beitragen?

- Installing contao/newsletter-bundle (4.9.2): Downloading (100%)
Generating optimized autoload files
> Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication
Script Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication handling the post-install-cmd event terminated with an exception
In ScriptHandler.php line 89:
  An error occurred while executing the "contao:install-web-dir" command:      
  In ConnectionFactory.php line 79:                                            
                                                                    
    An exception occured while establishing a connection to figure out your p  
  la                                                                           
    tform version.                                                             
                                                                               
    You can circumvent this by setting a 'server_version' configuration value  
                                                               
    For further information have a look at:                                    
                                                                               
    https://github.com/doctrine/DoctrineBundle/issues/673                      
                                                                   
  In AbstractMySQLDriver.php line 93:                                          
                                                                       
    An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for  
   u                                                                           
    ser 'root'@'localhost' (using password: NO)                                
                                                                     
  In PDOConnection.php line 31:                                                
                                                                    
    SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using p  
  as                                                                           
    sword: NO)                                                                 
                                                                     
  In PDOConnection.php line 27:                                                
                                                                 
    SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using p  
  as                                                                           
    sword: NO)                                                                 

@netzarbeiter
Copy link
Member

Dieses Problem ist mir auch schon begegnet, geholfen hat folgendes:

Ein Verzeichnis «config» erstellt und darin die Datei mit Namen «parameters.yml» mit folgendem Inhalt angelegt:

parameters:
    database_host: localhost
    database_port: 3306
    database_user: benutzer
    database_password: 'passwort'
    database_name: datenbankname

Danach die Paket Aktualisierung erneut starten.

@contaoacademy
Copy link
Author

contaoacademy commented Apr 6, 2020

Ich konnte jetzt die Ursache für den Fehler herausfinden.

Der Fehler entsteht dann, wenn ein anonymer User angelegt ist.
(siehe Screenshots)
Sobald der User gelöscht wird, funktioniert wieder alles.

Frage
Ist es ein Contao Problem oder ein Konfigurationsproblem?
Kann dieses Problem abgefangen werden?

user-accounts

users

Ein ähnliches Thema in einem anderen Zusammenhang siehe contao/core-bundle#736

@leofeyer
Copy link
Member

leofeyer commented May 1, 2020

Ist es ein Contao Problem oder ein Konfigurationsproblem?

Es ist auf jeden Fall kein Contao-Problem. Vermutlich hast Du mysql_secure_installation nicht ausgeführt, sonst wäre der anonyme Benutzer entfernt worden.

@m-vo
Copy link
Member

m-vo commented May 1, 2020

Für die lokale Entwicklung kannst du deinem Datenbankserver auch klarmachen, dass er Benutzer und Passwörter generell ignorieren soll:

#/etc(/mysql)/my.cnf

[mysqld]
skip-grant-tables

Macht das Leben leichter. 😄

@contaoacademy
Copy link
Author

@leofeyer
Ich habe im Grunde gar nichts gemacht, da ich davon ausgegangen bin, dass MAMP das schon für mich alles machen wird ;-)

@m-vo
Danke für den Tipp. Ich werde das testen.

Sollen wir das Ticket dann schließen, denn damit ist es ja kein Contao Problem.

@aschempp
Copy link
Member

aschempp commented May 2, 2020

Aus meiner Sicht ist es etwas, das wir verbessern sollten.

@leofeyer
Copy link
Member

leofeyer commented May 3, 2020

Und hast Du auch eine Idee, wie man das verbessern könnte?

@aschempp
Copy link
Member

aschempp commented May 4, 2020

Naja, wir machen ja bereits ein DB Connect um herauszufinden ob wir die server_version setzten müssen. Scheinbar reicht das nicht, d.h. wir müssten auch prüfen ob der (anonyme) User effektiv was tun kann? Vielleicht ein List Tables oder so?

@aschempp
Copy link
Member

aschempp commented May 5, 2020

see #1698 for the bug fix

@aschempp aschempp linked a pull request May 5, 2020 that will close this issue
@leofeyer leofeyer closed this as completed May 5, 2020
leofeyer pushed a commit that referenced this issue May 5, 2020
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #1631


If the database server allows anonymous connections, the current DB check does not fail as it should. The added `SHOW TABLES` is actually the same procedure already used by the install tool, I have also locally reproduced the problem and this fixes it.

Even though #1631 says the issue only appears in Contao 4.9 (which I can confirm), I think we should also fix/change this in 4.4, as it might be related to a change in Doctrine or Symfony that _could_ somewhen apply to 4.4 as well.

Commits
-------

66732c7 Fetch tables to check the database connection
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants