Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 02, 2017 Mysql-native - full database backup | ||||
---|---|---|---|---|
| ||||
Hi! How can i create a full database backup using mysql-native for D? https://github.com/mysql-d/mysql-native Thanks! |
January 05, 2017 Re: Mysql-native - full database backup | ||||
---|---|---|---|---|
| ||||
Posted in reply to Geert | On Monday, 2 January 2017 at 15:29:08 UTC, Geert wrote:
> Hi!
>
> How can i create a full database backup using mysql-native for D?
Too common question. Do you have problems with driver usage? Do you have problems with database backup schema?
|
January 05, 2017 Re: Mysql-native - full database backup | ||||
---|---|---|---|---|
| ||||
Posted in reply to crimaniak | On Thursday, 5 January 2017 at 01:16:09 UTC, crimaniak wrote:
> On Monday, 2 January 2017 at 15:29:08 UTC, Geert wrote:
>> Hi!
>>
>> How can i create a full database backup using mysql-native for D?
> Too common question. Do you have problems with driver usage? Do you have problems with database backup schema?
Sorry for not being specific, my english it's not quite good. I thought i could use a specific mysql-native method (like "execProcedure") for making database backups, but it seems it doesn't have it.
Anyway, i ended up using mysqldump with executeShell function:
string query = "mysqldump -uroot -ptest_pass test_db > /home/user/mydb_backup.sql";
executeShell(query);
For those who use lampp:
string query = "/opt/lampp/bin/mysqldump -uroot -ptest_pass test_db > /home/user/mydb_backup.sql";
executeShell(query);
|
January 05, 2017 Re: Mysql-native - full database backup | ||||
---|---|---|---|---|
| ||||
Posted in reply to Geert Attachments:
| Geert via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> napsal Čt, led 5, 2017 v 3∶13 : > On Thursday, 5 January 2017 at 01:16:09 UTC, crimaniak wrote: >> On Monday, 2 January 2017 at 15:29:08 UTC, Geert wrote: >>> Hi! >>> >>> How can i create a full database backup using mysql-native for D? >> Too common question. Do you have problems with driver usage? Do you >> have problems with database backup schema? > > Sorry for not being specific, my english it's not quite good. I thought i could use a specific mysql-native method (like "execProcedure") for making database backups, but it seems it doesn't have it. > > Anyway, i ended up using mysqldump with executeShell function: > > string query = "mysqldump -uroot -ptest_pass test_db > > /home/user/mydb_backup.sql"; > executeShell(query); > > > For those who use lampp: > > string query = "/opt/lampp/bin/mysqldump -uroot -ptest_pass test_db > > /home/user/mydb_backup.sql"; > executeShell(query); Yep, usin mysqldump is fine I've been using it for a quite time now void synchronizeDatbase(string host, string port, string portDst, string dbName) { import std.process: spawnShell, wait; writefln("Host: %s, DB: %s", host, dbName); auto pid = spawnShell("mysqldump --max_allowed_packet=1024M -C -h " ~ host ~ " -P" ~ port ~ " -u" ~ credentials.user ~ " -p" ~ credentials.pwd ~ " -R --add-drop-database --skip-triggers --ignore-table=cars.history -B " ~ dbName ~ " |" ~ " mysql -u" ~ credentials.user ~ " -p" ~ credentials.pwd ~ " -h 127.0.0.1 -P" ~ portDst); wait(pid); } |
January 05, 2017 Re: Mysql-native - full database backup | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Kozák | On Thursday, 5 January 2017 at 21:47:55 UTC, Daniel Kozák wrote:
> Geert via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> napsal Čt, led 5, 2017 v 3∶13 :
>> [...]
>
> [...]
Nice function. Thanks!
|
Copyright © 1999-2021 by the D Language Foundation