JIRA User Does Not Have Permission to Access the Database

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  1. JIRA throws a 404 error, and the following error is recorded in the logs:

    2010-03-23 08:47:42,918 main INFO [atlassian.jira.startup.JiraStartupLogger] Running JIRA startup checks.
    2010-03-23 08:47:43,818 main ERROR [jira.appconsistency.db.DatabaseConsistencyCheck] There was a SQL exception checking for database driver correctness. Skipping.
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'jira'@'hostname.example.com' (using password: YES))
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
  2. Attempting to modify the database throws a SQL Exception, as in the below examples:

    2013-01-13 21:30:04,084 localhost-startStop-1 WARN      [core.entity.jdbc.DatabaseUtil] Entity "FileAttachment" has 9 fields but table "fileattachment" has 7 columns.
    2013-01-13 21:30:04,085 localhost-startStop-1 WARN      [core.entity.jdbc.DatabaseUtil] Field "zip" of entity "FileAttachment" is missing its corresponding column "zip"
    2013-01-13 21:30:04,096 localhost-startStop-1 ERROR      [core.entity.jdbc.DatabaseUtil] Could not add column "zip" to table "fileattachment"
    2013-01-13 21:30:04,096 localhost-startStop-1 ERROR      [core.entity.jdbc.DatabaseUtil] SQL Exception while executing the following:
    ALTER TABLE fileattachment ADD zip DECIMAL(9,0)
    Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: ALTER command denied to user 'jira'@'localhost' for table 'fileattachment'
    ...
    Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: INDEX command denied to user 'jira'@'localhost' for table 'propertyentry'
    2013-01-13 21:30:04,215 localhost-startStop-1 ERROR      [core.entity.jdbc.DatabaseUtil] Could not create missing indices for entity "PortalPage"
    2013-01-13 21:30:04,215 localhost-startStop-1 ERROR      [core.entity.jdbc.DatabaseUtil] SQL Exception while executing the following:
    CREATE INDEX ppage_username ON portalpage (USERNAME)
    Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: INDEX command denied to user 'jira'@'localhost' for table 'portalpage'
    ...
    2013-01-13 21:30:51,555 localhost-startStop-1 ERROR      [net.java.ao.sql] Exception executing SQL update <ALTER TABLE AO_4AEACD_WEBHOOK_DAO DROP COLUMN JQL>
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: ALTER command denied to user 'jira'@'localhost' for table 'ao_4aeacd_webhook_dao'
    	at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    ...
    (SQL Exception while executing the following:INSERT INTO jiraaction (ID, issueid, AUTHOR, actiontype, actionlevel, rolelevel, actionbody, CREATED, UPDATEAUTHOR, UPDATED, actionnum) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT command denied to user 'jirauser'@'localhost' for table 'jiraaction'))

Cause

The JIRA user doesn't have the correct permission to access the database or the database user has a password with special characters on MySQL or SQL Server databases. The special character password case is tracked in the following bug: JRA-27796 - Getting issue details... STATUS

Resolution

Grant the appropriate permissions to the JIRA user, as per our Connecting JIRA to MySQL documentation:

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on <JIRADB>.* TO '<USERNAME>'@'<JIRA_SERVER_HOSTNAME>' IDENTIFIED BY '<PASSWORD>';
flush privileges;

(info) If, after granting the proper permissions for the user, the above error is still experienced, please modify the database password so that it does not use special characters.

Last modified on Jun 13, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.