Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet439/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   435   436   437   438   439   440   441   442   ...   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)

[
 338 
]
This will produce an output like the following:
Figure 13.1: Listing MariaDB databases
The output will show some system databases that were created for us, but our new 
database should be listed among them. We can also list users just as easily:
SELECT HOST, USER, PASSWORD FROM mysql.user; 
Entering this command will result in something similar to the following output:
Figure 13.2: Listing MariaDB users


Chapter 13
[
 339 
]
In a typical scenario, when installing an application that needs its own database, 
we'll create the database and then a user for that database. We'll normally want 
to give that user permission to only that database, with only as much permission 
as required to allow it to function properly. We've already created the 
mysampledb
 
database, so if we want to create a user with read-only access to it, we can do so with 
the following command:
GRANT SELECT ON mysampledb.* TO 'appuser'@'localhost' IDENTIFIED BY 
'password'; 
With one command, we're not only creating the user 
appuser
, but we're also setting 
a password for it, in addition to allowing it to have 
SELECT
 permissions on the 
mysampledb
 database. This is equivalent to read-only access. If our user needed full 
access, we could use the following instead:
GRANT ALL ON mysampledb.* TO 'appuser'@'localhost' IDENTIFIED BY 
'password'; 
To double-check that we've executed the command correctly, we can use this 
command to show the grants for a particular user:
SHOW GRANTS FOR 'appuser'@'localhost';
Now, our 
appuser
 has full access but only to the 
mysampledb
 database. Of course, 
we should only provide full access to the database if absolutely necessary. We can 
also provide additional permissions, such as 
DELETE
 (whether or not the user has 
permission to delete rows from database tables), 
CREATE
 (which controls whether the 
user can add rows to the database), 
INSERT
 (controls whether or not the user can add 
new rows to a table), 
SELECT
 (allows the user to read information from the database), 
DROP
 (allows the user to fully remove a database), and 
ALL
 (which gives the user 
everything). There are other permissions we can grant or deny; check the MariaDB 
documentation for more details. The types of permissions you'll need to grant to a 
user to satisfy the application you're installing will depend on the documentation for 
that software. Always refer to the installation instructions for the application you're 
attempting to install to determine which permissions are required for it to run.
If you'd like to remove user access, you can use the following command to do so 
(substituting 
myuser
 with the user account you wish to remove and 
host
 with the 
proper host access you previously granted the user):
DELETE FROM mysql.user WHERE user='myuser' AND host='localhost';


Managing Databases

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   435   436   437   438   439   440   441   442   ...   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