Actions

System Administrator's Guide/Granting Trigger Privilege: Difference between revisions

From Mahara Wiki

< System Administrator's Guide
(Created page with "If your Mahara database user does not have permission to create triggers on the database, you will need to explicitly grant the trigger privilege to the user. To do this, issue …")
 
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
If your Mahara database user does not have permission to create triggers on the database, you will need to explicitly grant the trigger privilege to the user.  To do this, issue the following command in your MySQL client:
If your Mahara database user does not have permission to create triggers on the database, you will need to explicitly grant the trigger privilege to the user.  To do this, issue the following command in your MySQL client:
For MySQL 5.7 and earlier:


   GRANT TRIGGER ON <mahara_db_name>.* TO '<mahara_db_user>'@'localhost';
   GRANT TRIGGER ON <mahara_db_name>.* TO '<mahara_db_user>'@'localhost';
 
For MySQL 8: see [https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0 How to grant all privileges to root user in MySQL 8.0 - Stack Overflow]
Replace <mahara_db_name> with the name of your Mahara database, and <mahara_db_user> with the database user.  You can find these values in your config.php file, under $cfg->dbname and $cfg->dbuser.
Replace <mahara_db_name> with the name of your Mahara database, and <mahara_db_user> with the database user.  You can find these values in your config.php file, under $cfg->dbname and $cfg->dbuser.


If you don't have access to the terminal client, but created the database user using some external tool like 'mysql administrator', you should be able to edit the user's permissions using the same tool.  Make sure the TRIGGER privilege is granted.
If you don't have access to the terminal client, but created the database user using some external tool like 'mysql administrator', you should be able to edit the user's permissions using the same tool.  Make sure the TRIGGER privilege is granted.
If you have granted trigger privileges to the appropriate user, but you are still having trouble upgrading or installing, try restarting mysql:
  sudo service mysql restart
the following post and bug report may also be helpful:
* https://mahara.org/interaction/forum/topic.php?id=4516#post20155
* http://bugs.mysql.com/bug.php?id=39489
==Binary logging==
Another problem with mysql and trigger privileges can be due to binary logging.
Check if you are doing binary logs.
On a Ubuntu/Debian system:
Look in /etc/mysql/my.cnf (or maybe my.ini), or in /etc/mysql/mysql.conf.d/mysqld.cnf.
Try adding
  log_bin_trust_function_creators = 1
If that doesn't work another way around this problem, if acceptable, is to disable binary logging.
To do it, remove the log_bin_trust_function_creators line and comment out log_bin and/or log_bin_index lines in the /etc/mysql/my.cnf (if they are there or in another cnf file)
After either change:
  sudo service mysql stop
  sudo service mysql start
See:
* http://stackoverflow.com/questions/1404107/permissions-for-creating-a-trigger-in-mysql

Latest revision as of 17:04, 26 April 2023

If your Mahara database user does not have permission to create triggers on the database, you will need to explicitly grant the trigger privilege to the user. To do this, issue the following command in your MySQL client:

For MySQL 5.7 and earlier:
 GRANT TRIGGER ON <mahara_db_name>.* TO '<mahara_db_user>'@'localhost';
For MySQL 8: see How to grant all privileges to root user in MySQL 8.0 - Stack Overflow

Replace <mahara_db_name> with the name of your Mahara database, and <mahara_db_user> with the database user. You can find these values in your config.php file, under $cfg->dbname and $cfg->dbuser.

If you don't have access to the terminal client, but created the database user using some external tool like 'mysql administrator', you should be able to edit the user's permissions using the same tool. Make sure the TRIGGER privilege is granted.

If you have granted trigger privileges to the appropriate user, but you are still having trouble upgrading or installing, try restarting mysql:

 sudo service mysql restart

the following post and bug report may also be helpful:


Binary logging

Another problem with mysql and trigger privileges can be due to binary logging.

Check if you are doing binary logs. On a Ubuntu/Debian system:

Look in /etc/mysql/my.cnf (or maybe my.ini), or in /etc/mysql/mysql.conf.d/mysqld.cnf. Try adding

 log_bin_trust_function_creators = 1

If that doesn't work another way around this problem, if acceptable, is to disable binary logging.

To do it, remove the log_bin_trust_function_creators line and comment out log_bin and/or log_bin_index lines in the /etc/mysql/my.cnf (if they are there or in another cnf file)

After either change:

 sudo service mysql stop
 sudo service mysql start

See: