Moving domains between users

The move database get's tricky, as there is no simple method to rename a DB. One basically needs to create a new empty DB and mysqldump|mysql from the old to the new one... having to deal with possible charset issues, since it's not a straight dump.
Also has the risk of toasting the data if the original is deleted after the copy.
Not impossible, but would be along the same lines as the move_domain.sh.

John
 
The move database get's tricky, as there is no simple method to rename a DB. One basically needs to create a new empty DB and mysqldump|mysql from the old to the new one... having to deal with possible charset issues, since it's not a straight dump.
Also has the risk of toasting the data if the original is deleted after the copy.
Not impossible, but would be along the same lines as the move_domain.sh.

John
I thought this http://help.directadmin.com/item.php?id=224 already did that...
 
Looks like I've been coding a long time :) You are correct, I wrote that a long time ago.
However, I believe that uses a method which is not entirely recommended by mysql,as it's manually renaming files, while MySQL may be using them, so although it likely works, I don't think it's the best method for going about it.
It also does all db users and all databases for a particular DA User, where we'd want a new script for just 1 db.

I just did a bit more Googling, and i believe I've found a better method.
1) Create a new DB
2) Use the RENAME TABLE syntax to move tables between the two databases.. which is safe, fast, and does not require any file renaming.
http://dev.mysql.com/doc/refman/5.0/en/rename-table.html said:
As long as two databases are on the same file system, you can use RENAME TABLE to move a table from one database to another:
3) Remove the old database.. which should be empty, and only if it's empty.

There is a RENAME DATABASE which likely does roughly the same thing the current change_database_username.php script, which is probably why they discontinued it, as it's unsafe, in theory.

John
 
Looks like I've been coding a long time :) You are correct, I wrote that a long time ago.
However, I believe that uses a method which is not entirely recommended by mysql,as it's manually renaming files, while MySQL may be using them, so although it likely works, I don't think it's the best method for going about it.
It also does all db users and all databases for a particular DA User, where we'd want a new script for just 1 db.

I just did a bit more Googling, and i believe I've found a better method.
1) Create a new DB
2) Use the RENAME TABLE syntax to move tables between the two databases.. which is safe, fast, and does not require any file renaming.

3) Remove the old database.. which should be empty, and only if it's empty.

There is a RENAME DATABASE which likely does roughly the same thing the current change_database_username.php script, which is probably why they discontinued it, as it's unsafe, in theory.

John
A year ago I've started a long discussion on this, stating that the script requires more than what it actually does (i.e renaming files).
but I think this is a good opportunity to first, fix that script according to the new 'standards' and then add an interface to it (or it to the interface)... :)


btw,
we are looking to move a DB's ownership to another DA user, and not change the table's names...
 
Last edited:
If you're asking if you can use scripts/custom/move_domain.sh, yes, you will be able to.
However, I have not yet started it's implementation.
If you want a move_domain_pre.sh and move_domain_post.sh, I can easily add that in.

John
 
Yes, despite the fact we move domain from one user to another, this action (as you know for sure) consists of two more common:

1. deleting the domain from an old user (so domain_destroy_pre.sh/domain_destroy_post.sh are supposed to run)
2. adding the domain to a new user (so domain_create_pre.sh/domain_create_post.sh are supposed to run)

So these scripts do not run for now if we execute scripts/custom/move_domain.sh in a shell, and as soon as we'll get possibility to move domains via web-interface, it would be a good idea to either add a move_domain_pre.sh and move_domain_post.sh, or execute existing POST/PRE scripts. For now I hesitate to make mind, what is even better. If we use move_domain_pre.sh and move_domain_post.sh we'll still be able to execute domain_destroy_pre.sh/domain_destroy_post.sh and domain_create_pre.sh/domain_create_post.sh, so let's choose move_domain_pre.sh and move_domain_post.sh. Any other ideas?
 
The domain isn't being destroyed or created.. it's being moved.. (data isn't being removed or added)
I think the move_domain_pre/post.sh is the simplest solution.. and not touch the domain_create/destory_pre/posh.sh scripts.

John
 
Generally yes, but in case we use NGINX (or any other reverse proxy), remote MAIL server, or anything else, which require update of its settings, we would still have the old settings, while domain is moved to another account and changed it's document root.

OK, move_domain_pre/post.sh is a good decision.
 
Generally yes, but in case we use NGINX (or any other reverse proxy), remote MAIL server, or anything else, which require update of its settings, we would still have the old settings, while domain is moved to another account and changed it's document root.

OK, move_domain_pre/post.sh is a good decision.
YES, thanks Alex, I thought I already said that those scripts are needed, but I couldn't find the relevant post.

anyway, I can see the feature has a version number (1.411), but FINISHED=NO.
was it released in this version...?
 
YES, thanks Alex, I thought I already said that those scripts are needed, but I couldn't find the relevant post.

anyway, I can see the feature has a version number (1.411), but FINISHED=NO.
was it released in this version...?
any update?
 
should I keep insisting, or this is one of those features that will never be available for use (although you already added it!)
 
It's available since version 1.312. I can see it, at the admin level, using the enhanced skin, under Admin Tools; it's called Move Users between Resellers. I don't know if it's available for other skins.

First make sure you've updated DirectAdmin to the latest version.

Then, if you're using a third-party skin, then ask your skin developer if he's implemented it, and if so where it can be found in the skin you're using.

If you're using a DirectAdmin skin, change to the enhanced skin to see if it appears there.

If it doesn't you'll need to contact DirectAdmin Support. If it does, either switch to the enhanced skin, or ask DirectAdmin Support to implement it in the other skins.

Jeff
 
It's available since version 1.312. I can see it, at the admin level, using the enhanced skin, under Admin Tools; it's called Move Users between Resellers. I don't know if it's available for other skins.

First make sure you've updated DirectAdmin to the latest version.

Then, if you're using a third-party skin, then ask your skin developer if he's implemented it, and if so where it can be found in the skin you're using.

If you're using a DirectAdmin skin, change to the enhanced skin to see if it appears there.

If it doesn't you'll need to contact DirectAdmin Support. If it does, either switch to the enhanced skin, or ask DirectAdmin Support to implement it in the other skins.

Jeff
well, yes, I have Move Users between Resellers, but the feature is Move Domain between Users!
so the value 1 or 2, allowing a reseller to move domains would actually make any sense...
 
Last edited:
Hi All,

Sorry for posting in this old topic, but i'm using the latest version of DA and I can't find: 'move_domains_between_users=0' inside directadmin.conf.
So it's still not possible to move domains between users from the DA interface? I added it to the conf file and restarted the directadmin service, but nothing shows up or i'm missing it completely.

Currently i'm working on a server that has almost 100 domains under 1 user.. Which need to be moved to new users.

Thanks
 
Hello,

If I run "/usr/local/directadmin/directadmin c" does not show move_domains_between_users.

Code:
# /usr/local/directadmin/directadmin c | grep move
removeip=/usr/local/directadmin/scripts/removeip
remove_clipboard_on_logout=1


So, I guess it's not implemented as of yet.

According to this: http://www.directadmin.com/features.php?id=1318 the feature is not finished:


Version Number1.471
FinishedNo
Typefeature
OverviewAbility to move domains between Users through the interface
 
Back
Top