Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet442/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   438   439   440   441   442   443   444   445   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 342 
]
Before I close this section though, I think it will be worthwhile for you to see how to 
back up and restore your databases. To do this, we have the 
mysqldump
 command at 
our disposal. Its syntax is very simple, as you'll see. First, exit the MariaDB shell and 
return to your standard Linux shell. Since we've already created an 
admin
 user earlier 
in the chapter, we'll use that user for the purposes of our backup:
mysqldump -u admin -p --databases mysampledb > mysampledb.sql
With this example, we're using 
mysqldump
 to create a copy of the 
mysampledb
 database 
and storing it in a file named 
mysampledb.sql
. Since MariaDB requires us to log in, 
we authenticate to MariaDB using the 
-u
 option with the username 
admin
 and the 
-p
 
option, which will prompt us for a password. The 
--databases
 option is necessary 
because, by default, 
mysqldump
 does not include the 
database create
 statement nor 
the tables. However, the 
--databases
 option forces this, which just makes it easier 
for you to restore. Assuming that we were able to authenticate properly, the contents 
of the 
mysampledb
 database will be dumped into the 
mysampledb.sql
 file. This export 
should happen very quickly, since this database probably only contains a single table 
and a few rows. Larger production databases can take hours to dump.
Restoring a backup is fairly simple. We can utilize the 
mariadb
 command with the 
backup file used as a source of input:
sudo mariadb -u admin -p < mysampledb.sql 
So, there you have it. The 
mysqldump
 command is definitely very handy in backing up 
databases. In the next section, we'll work through setting up a secondary database 
server.

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   438   439   440   441   442   443   444   445   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish