MySQL setup when oc_admin exists already
The current database procedure seems to do different things, depending on what kind of user is entered:
If an "unprivileged" user is entered, and the database exists already, everything seems to be set up correctly.
If a privileged user is entered however, then the setup will try to create a user called 'oc_admin' (and if no database with the given name exists, it will be created and oc_admin will be granted rights on it).
There's a problem with that latter approach: oc_admin can exist already; if it does, setup will result in an error message "MDB2 Error: connect failed: _doConnect: [Error message: unable to establish a connection] [Native code: 0] "
@icewind1991 @butonic can one of you please have a look? You know MDB2! THX
@DeepDiver1975 It's not MDB2-related, it's installation flow. When MySQL 'root' account is used and the name for owncloud admin is set to 'Dummy'. ownCloud creates DB user oc_Dummy and grants permissions on newly created database to this user.
If DB user oc_Dummy exists PRIOR to OC installation wrong credentials are used by ownCloud and installation fails.
Most easiest way to reproduce:
- Install 1st ownCloud instance with MySQL using privileged (root) Mysql user. Set ownCloud admin name to 'admin'. other settings are not essential
- Repeat step 1. Installation fails.
Reproducible both with master and stable45
it's fixed in master with #1148 , there is a warning now:
MySQL user 'oc_Admin'@'localhost' exists already. Drop this user from MySQL
Thus it's still not possible to install 2 ownCloud instances using privileged MySQL account using the same username for ownCloud admin account.
Not backported to stable45. @DeepDiver1975 can we close this issue?
I don't think this issue should be closed. I bet there are many other use cases where one would want to have several ownCloud instances with the same admin username - for debugging different versions it's a PITA, but that's another issue. Having an error message explaining the error is a step forward, although "Drop this user from MySQL" is a bulldozer solution ;)
imho OC should not create users in mysql at all by default. it should ask at least during the installation, if the current "privileged" user should be used or if it should create one. And if OC is creating one, it should ask for the username.
with 5.0 RC3 I got the following (mysql):
- 1st installation OK
- reinstall: KO drop this user message
- drop user, delete from mysql.user where user=admin, flush privileges, drop database
- got back to MDB2 Error: connect failed: _doConnect
@riso
You need to use
Drop user USER@localhost Drop user USER@'%'
(USER is the oc user name)
when i dropped both the users it still failed, but on the next try i dropped both the users and deleted config.php and it worked.
My (very vague) suspect is that for some reason it had an old hashed password. I always used the same password though, but I guess that the salt changes. Do you think that is possible?
I think the main panel is misleading. The lower part 'Configure the database MySQL will be used' should clearly state that the user here needs to be a MySQL-admin with the right to add users and to grant permissions. As soon as I figured this out the installation ran without problems.
@ewbrager
The lower part 'Configure the database MySQL will be used' should clearly state that the user here needs to be a MySQL-admin with the right to add users and to grant permissions.
In general he shouldn't. Alternatively he can have full access on the specified database and database should exist already
I’m closing this issue because it has been inactive for a few months. This probably means that the issue is not reproducible or it has been fixed in a newer version.
Please reopen if the error still persists with the latest stable version (currently ownCloud 5.0.9) and then please use the issue template. You an also contribute directly by providing a patch – see the developer manual. :)
Thank you!
This is still an issue. It becomes a problem when you have development and production environment. You can't test both without fiddling with the users.
I just got this issue with OC6 installation/upgrade using Mysql
The only way to fix that is to create a different account (maybe oc_admin1) in this case. Because we're not able to find out the password for the former one and can not override it as it may be in use. Is it a acceptable approach to add a sequential number at the end?
On mysql table, do this, works for me.
Drop user USER@localhost Drop user USER@'%'
(USER is the oc user name)
@craigpg This is in the ownCloud 5 milestone and the last open one in the closed milestone. Maybe have a look and triage.
This is fixed in the master branch and will be released together with ownCloud 8.