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

Cannot access the database #343

Closed
versant2612 opened this issue Apr 16, 2022 · 6 comments
Closed

Cannot access the database #343

versant2612 opened this issue Apr 16, 2022 · 6 comments

Comments

@versant2612
Copy link

With docker-compose logs --tail=20 -t I saw some error messagens in the log. How can I fix it?

mysql_1 | 2022-04-16T02:34:31.730288824Z 2022-04-16 2:34:31 10 [Warning] Access denied for user 'sqluser'@'172.18.0.8' (using password: YES)

wikibase_1 | 2022-04-16T02:34:54.387652753Z Cannot access the database: :real_connect(): (HY000/1045): Access denied for user 'sqluser'@'172.18.0.8' (using pclient_loop: send disconnect: Connection reset ... done

wikibase_1 | 2022-04-16T02:34:54.8314021Z Cannot access the database: :real_connect(): (HY000/1045): Access denied for user 'sqluser'@'172.18.0.8' (using password: YES). Check the host, username and password and try again. If using "localhost" as the database host, try using "127.0.0.1" instead (or vice versa).

@addshore
Copy link
Contributor

Hi @versant2612

I guess you are using the example docker-compose file?
Do you know which version?
Do you have modifications?
Does the site work at all?

@versant2612
Copy link
Author

Hi @addshore thanks for your reply. See the answers bellow. Let me know if there are more information needed.

I guess you are using the example docker-compose file? Yes. I attached the files used.
Do you know which version? docker-compose version 1.25.0, build unknown
Do you have modifications? Just port numbers
Does the site work at all? I don't think so, see log file, but How else can I check it?

_:/app/wikibase/wikibase-docker$ sudo docker-compose --env-file .env -f docker-compose.yml -f docker-compose.extra.yml up -d --build --force-recreate
WARNING: The OAUTH_CONSUMER_KEY variable is not set. Defaulting to a blank string.
WARNING: The OAUTH_CONSUMER_SECRET variable is not set. Defaulting to a blank string.
Recreating wikibase-docker_elasticsearch_1 ... done
Recreating wikibase-docker_wdqs_1 ... done
Creating wikibase-docker_mysql_1 ... done
Creating wikibase-docker_wikibase_jobrunner_1 ... done
Creating wikibase-docker_wikibase_1 ... done
Recreating wikibase-docker_quickstatements_1 ... done
Recreating wikibase-docker_wdqs-updater_1 ... done
Recreating wikibase-docker_wdqs-proxy_1 ... done
Recreating wikibase-docker_wdqs-frontend_1 ... done

_:/app/wikibase/wikibase-docker$ sudo docker-compose ps
Name Command State Ports

wikibase-docker_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
wikibase-docker_wikibase_1 /bin/bash /entrypoint.sh Restarting
wikibase-docker_wikibase_jobrunner_1 /bin/bash /jobrunner-entry ... Restarting

wikibase.zip

@addshore
Copy link
Contributor

Does the site work at all? I don't think so, see log file, but How else can I check it?

Try navigating to it on the port that you have selected.
But as it says Restarting i suspect it will not work indeed.

It sounds like this has never worked for you yet? and thus there is no data in your wiki right now.
So I would recommend using the docker-compose file for the last release that you intend on using.
https://www.mediawiki.org/wiki/Wikibase/Docker would be the docs to follow.

@versant2612
Copy link
Author

I've clean up the instalation, dowload the docker-compose file again and changed hosts variables from environment to localhost.
The error messagem changed but it is still a DB issue.

_: /app/wikibase$ sudo docker-compose ps

        Name                           Command                 State       Ports

wikibase_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
wikibase_wikibase_1 /bin/bash /entrypoint.sh Restarting
wikibase_wikibase_jobrunner_1 /bin/bash /jobrunner-entry ... Restarting

_: /app/wikibase$ sudo docker-compose logs

<...>
Using the PHP intl extension for Unicode normalization.
wikibase_1 | The environment has been checked. You can install MediaWiki.
wikibase_1 | Setting up database
wikibase_1 | done
wikibase_1 | Creating tables, step one
wikibase_1 | Warning: MediaWiki tables seem to already exist. Skipping creation.
wikibase_1 | done
wikibase_1 | Creating database user
wikibase_1 | done
wikibase_1 | Creating tables, step two
wikibase_1 | Wikimedia\Rdbms\DBQueryError from line 1719 of /var/www/html/includes/libs/rdbms/database/Database.php: Error 1050: Table 'user' already exists (mysql.svc:3306)
wikibase_1 | Function: Wikimedia\Rdbms\Database::sourceFile( /var/www/html/maintenance/tables.sql )
wikibase_1 | Query: CREATE TABLE user (
wikibase_1 | user_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
wikibase_1 | user_name varbinary(255) NOT NULL default '',
wikibase_1 | user_real_name varbinary(255) NOT NULL default '',
wikibase_1 | user_password tinyblob NOT NULL,
wikibase_1 | user_newpassword tinyblob NOT NULL,
wikibase_1 | user_newpass_time binary(14),
wikibase_1 | user_email tinytext NOT NULL,
wikibase_1 | user_touched binary(14) NOT NULL,
wikibase_1 | user_token binary(32) NOT NULL default '',
wikibase_1 | user_email_authenticated binary(14),
wikibase_1 | user_email_token binary(32),
wikibase_1 | user_email_token_expires binary(14),
wikibase_1 | user_registration binary(14),
wikibase_1 | user_editcount int,
wikibase_1 | user_password_expires varbinary(14) DEFAULT NULL
wikibase_1 | ) ENGINE=InnoDB, DEFAULT CHARSET=binary
wikibase_1 |
wikibase_1 |
wikibase_1 | #0 /var/www/html/includes/libs/rdbms/database/Database.php(1703): Wikimedia\Rdbms\Database->getQueryException('Table 'user' al...', 1050, 'CREATE TABLE u...', 'Wikimedia\\Rdbms...') wikibase_1 | #1 /var/www/html/includes/libs/rdbms/database/Database.php(1678): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Table 'user' al...', 1050, 'CREATE TABLE u...', 'Wikimedia\Rdbms...')
wikibase_1 | #2 /var/www/html/includes/libs/rdbms/database/Database.php(1244): Wikimedia\Rdbms\Database->reportQueryError('Table 'user' al...', 1050, 'CREATE TABLE u...', 'Wikimedia\\Rdbms...', false) wikibase_1 | #3 /var/www/html/includes/libs/rdbms/database/Database.php(5142): Wikimedia\Rdbms\Database->query('CREATE TABLE u...', 'Wikimedia\Rdbms...')
wikibase_1 | #4 /var/www/html/includes/libs/rdbms/database/Database.php(5077): Wikimedia\Rdbms\Database->sourceStream(Resource id #969, NULL, NULL, 'Wikimedia\Rdbms...', NULL)
wikibase_1 | #5 /var/www/html/includes/installer/DatabaseInstaller.php(233): Wikimedia\Rdbms\Database->sourceFile('/var/www/html/m...')
wikibase_1 | #6 /var/www/html/includes/installer/DatabaseInstaller.php(267): DatabaseInstaller->stepApplySourceFile('getSchemaPath', 'install-manual', 'revision')
wikibase_1 | #7 /var/www/html/includes/installer/Installer.php(1714): DatabaseInstaller->createManualTables(Object(MysqlInstaller))
wikibase_1 | #8 /var/www/html/includes/installer/CliInstaller.php(211): Installer->performInstallation(Array, Array)
wikibase_1 | #9 /var/www/html/maintenance/install.php(142): CliInstaller->execute()
wikibase_1 | #10 /var/www/html/maintenance/doMaintenance.php(112): CommandLineInstaller->execute()
wikibase_1 | #11 /var/www/html/maintenance/install.php(203): require_once('/var/www/html/m...')
wikibase_1 | #12 {main}
wikibase_1 | Notice: Uncommitted DB writes (transaction from DatabaseInstaller::stepApplySourceFile) in /var/www/html/includes/libs/rdbms/database/Database.php on line 5605

wd-composer.log

@addshore
Copy link
Contributor

From the attached log the first thing that I notice is

�[32mwikibase_jobrunner_1  |�[0m /jobrunner-entrypoint.sh: /jobrunner-entrypoint.sh: Is a directory

You need the jobrunner-entrypoint.sh from the example directory in the same directory as your docker compose file https://github.com/wmde/wikibase-release-pipeline/tree/main/example

Next...

�[33mwikibase_1            |�[0m Wikimedia\Rdbms\DBQueryError from line 1719 of /var/www/html/includes/libs/rdbms/database/Database.php: Error 1050: Table 'user' already exists (mysql.svc:3306)

This indicates that you are running with an empty LocalSettings.php but not an empty database.

Either

  1. Mount a LocalSettings file with the correct settings to access the database that you ahve
  2. Remove the database and then try setting it up again (so installation happens again). If you don't mind loosing the data that may already exist you can do this with docker-compose down with volumes being removed)

@versant2612
Copy link
Author

versant2612 commented Apr 24, 2022

Thank you @addshore. It worked.

I've copied jobrunner-entrypoint.sh and clean up the installation again (this time I used docker rm and docker rmi to remove each container and image).

/app/wikibase$ sudo docker-compose ps
Name Command State Ports

wikibase_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
wikibase_wikibase_1 /bin/bash /entrypoint.sh Up 0.0.0.0:80->80/tcp,:::80->80/tcp
wikibase_wikibase_jobrunner_1 /bin/bash /jobrunner-entry ... Up 80/tcp

The site is working and I was able to create my user account and a new Item (Q1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants