Database User Privileges

Events happening in the community are now at Drupal community events on www.drupal.org.
jacobson's picture

I am running 0.4-alpha7. I am trying to migrate a site from D6.14 to D6.16 and have encountered two problems:

  1. The mysqldump fails because the database user does not have LOCK TABLES privilege. I am not aware that this privilege is required by Drupal, so I'm assuming that the privilege is needed by the mysqldump script created by Aegir during a migrate. Is this correct? Is the requirement for this privilege documented?
  2. An error occurs during the migrate as a result of Aegir's conclusion that the "schema" for lightbox2 on the D6.14 site (6100) is newer than the schema on the destination D6.16 site (3). The destination site has the newest lightbox2 in the sites/all/modules directory, as does the D6.14 source site. The update.php has been run on the source site but obviously not on the destination site, since it has not been installed yet. The "Compare Platforms" output from the Migrate destination select dialog shows that both the source and destination site have the (3) lightbox2 schema. I cannot figure out why Aegir insists that the schemas do not match or why Aegir believes that the source site has schema 6100.

Thanks.

Comments

DB Privileges discussed here

timwood's picture

http://groups.drupal.org/node/24992 in sections titled "Transfer the Database". To quote:

Then create the mysql user that your site accesses the database as, and grant it all permissions on that database except 'GRANT'.

Not sure about #2.

I Skipped This Step

jacobson's picture

When I installed Aegir, I was installing on the same server on which my existing drupal sites were running. So, I had no need to "transfer the database." As a result, I skipped the step to which you refer.

Thanks.

HAJ

It happens with some sites

omega8cc's picture

It happens with some sites (and it is not Aegir issue, imho), I have seen this on d5 import and since dbuser with required grants is created on the fly, there is no chance to add required (by this site, not by Aegir) privileges before the import/clone/migrate and you have to patch (temporarily) provision to add privileges on the fly.

The error I have seen was:

Importing database using command: mysql --defaults-file=/dev/fd/3 site_951_0
Database import failed: ERROR 1227 (42000) at line 2244: Access denied; you need the SUPER privilege for this operation
An error occurred at function : drush_provision_mysql_provision_deploy
Dropping database site_951_0
Revoking privileges of site_951_0@% from site_951_0

So I had to use this patch:

--- a/provision/db_server/provision_mysql.drush.inc     2010-04-26 05:03:52.000000000 +0100
+++ b/provision/db_server/provision_mysql.drush.inc     2010-04-29 09:57:21.000000000 +0100
@@ -130,6 +130,7 @@ function _provision_mysql_can_create_dat

function _provision_mysql_grant($name, $username, $password, $host = '') {
   $host = ($host) ? $host : '%';
+  provision_db_query("GRANT SUPER ON *.* TO %s@%s IDENTIFIED BY '%s'", $username, $host, $password);
   return provision_db_query("GRANT ALL PRIVILEGES ON %s.* TO %s@%s IDENTIFIED BY '%s'", $name, $username, $host, $password);
}

Just replace GRANT SUPER with GRANT LOCK TABLES and it should work.

Remember to revert the patch when it is done.

Regarding the second issue -

omega8cc's picture

Regarding the second issue - I would suggest to post it in the Aegir issue queue, since I have also seen that and had to manually change schema numbers in the Aegir db, however don't remember enough details now.

I had this same problem but

pcambra's picture

I had this same problem but migrating a site of platform, applying the patch suggested (provision_db_query("GRANT SUPER ON . TO %s@%s IDENTIFIED BY '%s'", $username, $host, $password);) all worked fine.

The sites are D6, the old platform running on D6.16 y the new in 6.17

Should I revert the patch anyway?

Having sites/users with GRANT

omega8cc's picture

Having sites/users with GRANT SUPER privileges is probably a bad idea, so yes, revert it if you no longer experience this problem on import/migration.

Just to weigh in

zkrebs's picture

I had this problem, and the patch doesn't seem to work with Aegir Alpha 12.

The core of the issue was my Ubercart_views module. Read this thread: http://www.ubercart.org/forum/support/15169/importing_db - after I removed the module, and uninstalled it, I was able to migrate / clone my site successfully.

this is a known issue

adrian's picture

http://drupal.org/node/881496

and the problem is mysql being a horrible excuse for a database.

to work around it we would need to modify database dumps on the fly.

see 881496

attiks's picture

I posted a patch in [#881496], to fix it, but it probably needs some reviewing

Thanks Slavojzizek it was the

Macronomicus's picture

Thanks Slavojzizek it was the Ubercart views module getting in the way... disabled that and cloning worked again.

grant super

bgm's picture

Isn't granting "super" privileges going to cause problems once the user in the DEFINER is deleted? (i'm also having this problem with multi-language CiviCRM databases, which rely heavily on views/triggers)

I am having this issue with

bmx269's picture

I am having this issue with my Barracuda install, and need to know what file to patch?

Thanks

Aegir hosting system

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: