19定庵、配置MariaDB數(shù)據(jù)庫(kù)
要求:
創(chuàng)建MariaDB數(shù)據(jù)庫(kù)缕陕,數(shù)據(jù)庫(kù)名為Contacts
從mariadb.dump恢復(fù)數(shù)據(jù)庫(kù)內(nèi)容
數(shù)據(jù)庫(kù)只能被localhost訪問(wèn)
除了root用戶,此數(shù)據(jù)庫(kù)只能被jack查詢放典,查詢密碼password
root密碼為rootpassword,不允許空密碼登錄
yum groupinstall -y mariadb mariadb-server mariadb-client
vim /etc/my.cnf
skip-networking=1
systemctl restart mariadb
systemctl enable mariadb
wget http://xxxxx/mariadb.dump
mysql
>show databases;
>create database Contracts;
>use Contacts;
>source /root/mariadb.dump;
>show tables;
>grant select on Contacts.* to jack@'localhost' identified by 'password'
mysql_secure_installation #設(shè)置root密碼,設(shè)置只允許localhost訪問(wèn)
20逛绵、數(shù)據(jù)庫(kù)查詢
要求:
查詢數(shù)據(jù)庫(kù)Contacts里:
密碼是123456的人的名字怀各?
用戶id是234的用戶名稱?
mysql
>use Contacts;
>show tables;
>select * from user_logins where User_pass='123456';
>select * from user_names where user_id='234'
>