2018-12-12 Redhat 7进阶自测(七)

19、配置MariaDB数据库
要求:
创建MariaDB数据库,数据库名为Contacts
从mariadb.dump恢复数据库内容
数据库只能被localhost访问
除了root用户,此数据库只能被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   #设置root密码,设置只允许localhost访问

20、数据库查询
要求:
查询数据库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'
> 

你可能感兴趣的:(2018-12-12 Redhat 7进阶自测(七))