Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Database: Safest way #77

Closed
pedrohenriquerissato opened this issue Jun 26, 2019 · 4 comments
Closed

Migrate Database: Safest way #77

pedrohenriquerissato opened this issue Jun 26, 2019 · 4 comments

Comments

@pedrohenriquerissato
Copy link

Hello!

I need to migrate the dotProject database from host, ie.: .100 to .175, but since i'm not suppose to manually edit config-dist.php ou config.php, what is the correct way of doing this, without deleting/erasing the actual database on .100? I'm afraid pointing out to /install and the scripts ends up deleting my populated database.

@Givo29
Copy link
Contributor

Givo29 commented Jun 27, 2019

Hi,
On the new host you should be able to go through the install normally without it affecting the database on the old host. This should create a blank database on the new host, ideally with the same name and permissions as on old host.

On the old host, take a mysqldump if you don't already have one and bring it over to the new host.

From here on the new host you should be able to run a command like:

mysql -u username -p database_name < dump_file.sql

and the new database will be populated with all your old data.

Edit: If you're worried about messing up the old database it would be worth taking the mysqldump first so you will still have all the data if something does goes wrong.

Edit 2: Assuming you're going from an older dotproject version to a new one, you will also have to upgrade the database. This can be done by dumping the old data in the new database first, then going through the dotproject install wizard as usual.

@pedrohenriquerissato
Copy link
Author

pedrohenriquerissato commented Jun 27, 2019

Hi Givo, thank you for the quick answer. But I don't want to migrate the hole application, just migrate the database. The application (php/apache server) will remain on server .100, for ie., and only the database I need to migrate to another server where all other MySQL databases are. The problem is about editing manually those config files on /include. Besides the warning about not to do it manually, could I? Is there any side effect of doing it?

Regards!

@Givo29
Copy link
Contributor

Givo29 commented Jun 27, 2019

Ok I understand. You should be able to edit any files you need to without any side effects. You can always revert your changes with git in case something does happen, and if you take an sqldump of all your data before hand you will be fine.

There are a couple of files that are excluded from git however so a general backup may also be a good idea.

@pedrohenriquerissato
Copy link
Author

Thank you Givo.

Made a full backup of database (parameters are optional):
mysqldump -u USER -p DATABASE --single-transaction --quick --lock-tables > FILENAME

Created the database users manually. Gave permissions and flush privileges on the new database server.

Then, modified ../include/config.php from dotproject folder:
$dPconfig['dbhost'] = 'NEW IP'

  • IP without port: 0.0.0.0

Saved config.php and that's it. Everthing works flawless! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants