J4 Issue ?
avatar Oemand
Oemand
14 Feb 2020

Steps to reproduce the issue

Start installation of joomla.
Don't change the default suggested databasename.
Fill out the rest correctly.
The installer gives you an error that your database user do not have enough permisions to create database.
You change the database name and resubmit.
Gives you "0 A Database error occurred."
Cannot install joomla.

Please see video: https://www.dropbox.com/s/nwwwinv9703yvr1/joomla-instalation-error.mp4?dl=0

Expected result

Be able to change database name and finish installation

Actual result

Not able to finish installation

System information (as much as possible)

Newest joomla 4 beta version downloaded today.
PHP 7.3

Additional comments

avatar Oemand Oemand - open - 14 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 14 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Feb 2020
avatar richard67
richard67 - comment - 14 Feb 2020

2 questions:

  1. Which kind of database are you using? MySQL? Or PostgreSQL?
  2. Does the database user have the permission to create databases?
avatar GCLW
GCLW - comment - 14 Feb 2020

Looking at the attached video. Why is Joomla! even attempting to create a database?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27924.

avatar jwaisner jwaisner - change - 14 Feb 2020
Status New Information Required
avatar chmst
chmst - comment - 14 Feb 2020

You first have to install a database, did you install the database "joomla_db". And can access it via phpMyAdmin, also if it is empty?

My hosting panels all require database names to have a certain structure, so I never can use the default name on servers.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27924.

avatar brianteeman
brianteeman - comment - 14 Feb 2020

Looking at the attached video. Why is Joomla! even attempting to create a database?

It does this by design - some people think its a convenient feature. I did try to remove that in the past but that was rejected

avatar chmst
chmst - comment - 14 Feb 2020

It is a nice feature. I like it when working local. What about adding an information to the install screen that the database must be installed and accessible on the server?

avatar richard67
richard67 - comment - 14 Feb 2020

I did try to remove that in the past but that was rejected

Pity. I would have supported removal.

avatar alikon
alikon - comment - 14 Feb 2020

i'm unable to replicate this behaviour on PDO postgresql, where my user don't have the GRANT to create a new database, after setting the correct available database under my user the installation goes successfully to end

p.s
even if i can agree in some way that on localhost can be maybe handy, in the wild, it is quite rare that your user have the GRANT to create a new database

avatar alikon
alikon - comment - 14 Feb 2020

can someone replicate the issue under a mysql db ?

avatar brianteeman
brianteeman - comment - 14 Feb 2020

@alikon

after setting the correct available database

The report says

Don't change the default suggested databasename.

avatar richard67
richard67 - comment - 14 Feb 2020

@brianteeman @alikon means the 2nd part of the test, try with correct information after first attempt failed, see in issue description:

You change the database name and resubmit.
Gives you "0 A Database error occurred."
Cannot install joomla.

avatar alikon
alikon - comment - 14 Feb 2020

yes, i've understood that, but,
i've done the same steps on a pdo postgresql
where i don't have the GRANT to create a new database
so 1st attempt with a new db name the correct error message has been display
after i've setted the already existing db name .... but i've got no error and the installation went fine
so i've asked to replicated the same on a mysql.......unfortunately I currently don't have on my laptop

avatar brianteeman
brianteeman - comment - 14 Feb 2020

sorry I should have watched the video

avatar richard67
richard67 - comment - 14 Feb 2020

@alikon I'll test tomorrow if still necessary then. Today I am off my desk.

avatar richard67
richard67 - comment - 14 Feb 2020

It might be that particular hosters don't allow underscore in db name, like we have it in the default name, and maybe this causes the connection abort due to missing error handling, or the hoster's db (or our db driver or the db cleitn or whatever) behaves strange with that, but when having other error, e.g. missing privilege, the hoster (or our db driver or the db cleitn or whatever) reacts correct and returns the right error.

Just an idea.

avatar brianteeman
brianteeman - comment - 14 Feb 2020

I have tested it and can confirm the exact results.

If you have the wrong details and then try to connect with the correct details then you get the error as described

avatar brianteeman brianteeman - change - 14 Feb 2020
Labels Added: ?
avatar brianteeman brianteeman - labeled - 14 Feb 2020
avatar richard67
richard67 - comment - 14 Feb 2020

I have an idea where to look for it in our code .. will do so tomorrow.

avatar richard67
richard67 - comment - 14 Feb 2020

I agree with beta-blocker.

avatar alikon
alikon - comment - 14 Feb 2020

then it should be a mysql driver issues.... postgresql rocks ?

avatar alikon alikon - change - 15 Feb 2020
Labels Added: J4 Issue ?
Removed: ?
avatar alikon alikon - labeled - 15 Feb 2020
avatar jwaisner jwaisner - change - 15 Feb 2020
Status Information Required Confirmed
avatar joomla-cms-bot joomla-cms-bot - change - 15 Feb 2020
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - unlabeled - 15 Feb 2020
avatar jwaisner jwaisner - change - 15 Feb 2020
Build staging 4.0-dev
avatar richard67
richard67 - comment - 16 Feb 2020

I was not able to reproduce it on a Linux host, neither with MySQL 5.7 (both MySQLi and PDO driver) nor with PostgreSQL10.10.

Maybe it's related to a particluar DB server or client version? Or it needs to remove the cookie with the saved session information before each test?

avatar richard67 richard67 - change - 16 Feb 2020
Labels Added: ?
avatar richard67 richard67 - labeled - 16 Feb 2020
avatar richard67
richard67 - comment - 16 Feb 2020

Ok, now I have tested again with deleting the session cookie before each test. I could replicate the issue with the "MySQLi" driver, but not with "MySQL (PDO)" and also not with "PostgreSQL (PDO)".

@brianteeman Have you tested with "MySQLi"? If yes, what happens for you if you try with "MySQL (PDO)" and remove the session cookie before the test, if there is one?

avatar richard67
richard67 - comment - 16 Feb 2020

On J3 it seems that we don't have this issue. There is no default db name suggested, but when I manually enter the wrong "joomla_db" and then get the error not having the privilege to create the db and then correct the db name to the right, existing db, installation continues and finishes with success at the end.

So I can confirm it is a J4 issue or if a framework issue then a 2.0-dev issue there.

avatar brianteeman
brianteeman - comment - 16 Feb 2020

it is nothing to do with a default_db name
it is something to do with the new installation code

avatar richard67
richard67 - comment - 16 Feb 2020

@brianteeman Yes. But can you confirm it doesn't happen with "MySQL (PDO)", only with "MySQLi"?

avatar brianteeman
brianteeman - comment - 16 Feb 2020

it does happen with pdo
as soon as you try to install with the wrong database credentials and get the error then any changed credentials are not "honoured"

avatar richard67
richard67 - comment - 16 Feb 2020

Must be something in the new installer code, I agree. installation/src/Model/SetupModel.php or installation/src/Model/DatabaseModel.php ... somewhere there.

avatar brianteeman
brianteeman - comment - 16 Feb 2020

the installer is such a pile of poop I dont know why we use it

avatar richard67
richard67 - comment - 16 Feb 2020

Yes, I just ask myself if it was a moment of masochism when having assigned this issue to myself.

avatar HLeithner HLeithner - change - 16 Feb 2020
Labels Added: ?
Removed: ?
avatar HLeithner HLeithner - unlabeled - 16 Feb 2020
avatar HLeithner HLeithner - labeled - 16 Feb 2020
avatar HLeithner
HLeithner - comment - 16 Feb 2020

It's not a beta blocker we cause it fixing this wouldn't case a b/c break

avatar wilsonge wilsonge - change - 16 Feb 2020
Labels Added: ?
avatar wilsonge wilsonge - labeled - 16 Feb 2020
avatar wilsonge wilsonge - change - 16 Feb 2020
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 16 Feb 2020
avatar richard67
richard67 - comment - 17 Feb 2020

@wilsonge I've assigned this issue to myself and will try to find the error and fix it, but I can do it mainly on weekends only, and it might be that I need help/advise. Maybe it is a similar issue than the one we had with language changing at the end of installation, which you have fixed a while ago, regarding what is saved in the session and what is taken when from the form. So if you find time to have a look on it, too, it would be very welcome.

P.S.: With what you have once fixed I meant PR #27439 .

Of course other readers too are welcome to help and advise.

avatar jwaisner jwaisner - change - 17 Feb 2020
Priority Medium Urgent
avatar joomla-cms-bot joomla-cms-bot - change - 17 Feb 2020
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - unlabeled - 17 Feb 2020
avatar jwaisner
jwaisner - comment - 17 Feb 2020

Increasing priority as per guidelines for beta-blockers.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27924.

avatar richard67 richard67 - change - 17 Feb 2020
Labels Added: ?
avatar richard67 richard67 - labeled - 17 Feb 2020
avatar wilsonge wilsonge - change - 18 Feb 2020
Labels Added: ?
Removed: ?
avatar wilsonge wilsonge - unlabeled - 18 Feb 2020
avatar wilsonge wilsonge - labeled - 18 Feb 2020
avatar richard67
richard67 - comment - 1 Mar 2020

This issue would be pretty easy to solve with changing 1 value in 1 line of code if we would drop the possibility to let the installation create a database if it doesn't exist yet. Am still clarifying on diverse channels, opinions are welcome. If necessary I will make an RFC issue or RFC PR. If keeping the feature to create the db, it could become more complicated.

avatar wilsonge
wilsonge - comment - 2 Mar 2020

I'd rather keep the feature - but I need some time to figure out where the right place is - we probably can't validate we have permissions to create DBs in the validate step (but need to confirm that after reading some docs). So likely we need to improve how the error reporting works from the installer itself

avatar richard67
richard67 - comment - 2 Mar 2020

we probably can't validate we have permissions to create DBs in the validate step

@wilsonge Replace the "probably" by "very likely" or even "for sure". Currently there is no check if the user can create databases or not, there is just a check if connection failed, and if so, it is tried to determine by the particular error message if the database is missing or not, and if missing, it is tried to create it (all in the DatabaseModel of the installation). Depending on the particular database type and driver type and on the particular user the error returned can be very different and so not really be useful to detect what the problem is, database not existing or user not having privileges to connect without selecting the database. Read the code in the DatabaseModel and you will see it is a mess. Another thing is that you can't verify the server version and the connection encryption settings when not being connected to a database (at least our driver seems not to allow that). And so we would have to shift these parts of connection validation to after the attempt to create the db in the database model, or we mode the attempt to create the db to the setup model's connection validation step. I would prefer the latter because from my point of view having the database belongs to the connection validation. Of course that would not save us from improving error handling in case if some later step, e.g. create a table, fails, but it would make the connection validation less complicated because all would be at one place.

avatar richard67
richard67 - comment - 8 Mar 2020

Please test #28273 .

avatar richard67
richard67 - comment - 8 Mar 2020

Closing as having PR. Issue always can be re-opened if PR is not good.

avatar richard67 richard67 - change - 8 Mar 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-03-08 14:43:35
Closed_By richard67
avatar richard67 richard67 - close - 8 Mar 2020
avatar richard67 richard67 - change - 9 Mar 2020
Status Closed New
Closed_Date 2020-03-08 14:43:35
Closed_By richard67
avatar richard67 richard67 - reopen - 9 Mar 2020
avatar richard67
richard67 - comment - 9 Mar 2020

Reopening because PR #28273 has just been closed.

The PR was correct and solved the issue, but it went into a wrong direction, see @wilsonge 's comment there.

Will try to make a new PR, but it may take some days until I find time, very likely weekend.

avatar jwaisner jwaisner - change - 9 Mar 2020
Status New Confirmed
avatar richard67
richard67 - comment - 14 Mar 2020
avatar richard67 richard67 - change - 14 Mar 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-03-14 22:37:33
Closed_By richard67
avatar richard67
richard67 - comment - 14 Mar 2020

Closing as having a Pull Request (PR).

avatar richard67 richard67 - close - 14 Mar 2020
avatar wilsonge wilsonge - change - 24 Mar 2020
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 24 Mar 2020

Add a Comment

Login with GitHub to post a comment