从http://classroom.example.com/content/materilas/users.mdb下载数据库复制内容 //该文件定义表结构 存储表数据
[root@server0 ~]# yum groupinstall MariaDB –y ////安装数据库文件
[root@server0 ~]# systemctl enable mariadb.service ////开机自启数据库服务
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@server0 ~]# systemctl restart mariadb.service ////启动数据库服务
[root@server0 ~]# mysql_secure_installation ////配置数据中安全控制相关设置
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
Enter current password for root (enter for none): ////直接回车,新数据库无密码
Set root password? [Y/n] y ////选择y,root密码设置成题目要求的
New password:
Re-enter new password:
Password updated successfully!
Remove anonymous users? [Y/n] y ////选择y,移除匿名访问
... Success!
Disallow root login remotely? [Y/n] y ////选择y,关闭root远程访问
... Success!
Remove test database and access to it? [Y/n] y ////选择y,移除测试库
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y ////选择y,重新加载权限
... Success!
[root@server0 ~]# mysql –p ////配置数据库信息
Enter password:
MariaDB [(none)]> create database Contacts; ////创建数据文件
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user Luigi@localhost identified by "cetterde"; ////创建用户
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant select on *.* to Luigi@localhost; ////赋予用户权限
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@server0 ~]# wget http://classroom.example.com/content/materilas/users.mdb ////下载数据库复制文件
[root@server0 ~]# vim users.mdb ////导入下载的数据库复制文件
USE Contacts
[root@server0 ~]# mysql -p < users.mdb > ////测试登录
Enter password: