I am installing cBioPortal on a AWS EC2 instance (r5.xlarge) and I am running into an issue with database permissions.
I am following this guide and working from the master branch (commit fe39b4b) of the cbioportal-docker-compose repo.
After I run the init.sh script and load the example dataset, the backend container, cbioportal_container, fails to connect to the database.
For each attempt, I have the following line in the cbioportal_database_container log:
'@'172.26.0.5' (using password: YES) Access denied for user 'cbio_user
The backend container reports a successful connection, though.
Using database config:
db.host=cbioportal_database:3306
db.user=cbio_user
db.portal_db_name=cbioportal
db.password=somepassword
Database connection success
If I step into the running cbioportal_database_container container and attempt to log in with the cbio_user credentials, I am able to do so.
$ docker exec -it cbioportal_database_container bash
root@<CONTAINER_ID>:/# mysql -u cbio_user -p
Enter password: ********
mysql>
The result is that the app runs but does not show any loaded datasets, though the database does contain one.
I am wondering if this is caused by the stray single-quote in the log message that is at the front of cbio_user in the log message above.
I went ahead and created a user with a stray single-quote just to check but the log in did not succeed. I still get the Access denied in the cbioportal_database_container logs.
mysql> SELECT User, Host, plugin FROM mysql.user;
+---------------+-----------+-----------------------+
| User | Host | plugin |
+---------------+-----------+-----------------------+
| root | localhost | mysql_native_password |
| mysql.session | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
| root | % | mysql_native_password |
| cbio_user | % | mysql_native_password |
| 'cbio_user | % | mysql_native_password |
+---------------+-----------+-----------------------+
I have changed the db.user in config/portal.properties to cbio_user_2 and found that the user was denied access but with different logs.
cbioportal_container
Using database config:
db.host=cbioportal_database:3306
db.user=cbio_user_2
db.portal_db_name=cbioportal
db.password=somepassword
Database connection success
Migrating database if necessary...
(1045, "Access denied for user 'cbio_user_2'@'192.168.0.5' (using password: YES)")
--> Error connecting to server cbioportal_database on port 3306
Traceback (most recent call last):
File "/cbioportal/core/src/main/scripts/migrate_db.py", line 54, in get_db_cursor
db = portal_properties.database_name)
File "/usr/local/lib/python3.7/dist-packages/MySQLdb/__init__.py", line 85, in Connect
return Connection(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'cbio_user_2'@'192.168.0.5' (using password: YES)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/cbioportal/core/src/main/scripts/migrate_db.py", line 336, in <module>
main()
File "/cbioportal/core/src/main/scripts/migrate_db.py", line 320, in main
connection, cursor = get_db_cursor(portal_properties)
File "/cbioportal/core/src/main/scripts/migrate_db.py", line 66, in get_db_cursor
raise ConnectionError(message) from exception
ConnectionError: --> Error connecting to server cbioportal_database on port 3306
cbioportal_database_container
'@'192.168.0.5' (using password: YES)Access denied for user 'cbio_user_2
2020-09-15T14:36:30.578745Z 3 [Note] Access denied for user 'cbio_user_2'@'192.168.0.5' (using password: YES)
In the database container, the access denied log is presented twice; one is like the log posted above and the other is a properly formatted. Also, the backend container knows has been denied access in this case.
Any ideas into how this may have happened or what I can do to remedy this?
Could anyone please address this question? I see the same issue as well.
Seems the issue can be fixed by:
dos2unix config/portal.properties
Hey @sdpetrides - did the suggestion above solve your issue?
It might help to delete everything with docker-compose -v, delete the full repo and then clone it again fresh. That way your properties file should be completely clean again too. Make sure to restart the webapp container after loading the database (see instructions here https://github.com/cbioportal/cbioportal-docker-compose#run-cbioportal-using-docker-compose)
Hopefully some of these suggestions helped solve your issue. Let me know if not and we can re-open the ticket