使用mariadb数据库管理系统
数据库就是个高级的表格软件。
常用数据库(Mysql、Oracle、db2、sqlserver、mariadb)
mariadb作为centOS7系统的默认的数据库管理系统。下面分步骤进行讲解。
一、安装mariaDB数据库主程序
1、安装
[root@VM_0_12_centos ~]# yum install mariadb mariadb-server
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): epel/7/x86_64/group_gz | 95 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 165 kB 00:00:00
(3/4): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
(4/4): epel/7/x86_64/primary_db | 6.8 MB 00:00:01
Resolving Dependencies
–> Running transaction check
—> Package mariadb.x86_64 1:5.5.64-1.el7 will be installed
—> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be installed
–> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.64-1.el7.x86_64
–> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.64-1.el7.x86_64
–> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
–> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
–> Running transaction check
—> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
—> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
–> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
–> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
—> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
–> Running transaction check
—> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
–> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Running transaction check
—> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
–> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
–> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
—> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
–> Running transaction check
—> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
—> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
mariadb x86_64 1:5.5.64-1.el7 os 8.7 M
mariadb-server x86_64 1:5.5.64-1.el7 os 11 M
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 os 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 os 57 k
perl-DBD-MySQL x86_64 4.023-6.el7 os 140 k
perl-DBI x86_64 1.627-4.el7 os 802 k
perl-Data-Dumper x86_64 2.145-3.el7 os 47 k
perl-IO-Compress noarch 2.061-2.el7 os 260 k
perl-Net-Daemon noarch 0.48-5.el7 os 51 k
perl-PlRPC noarch 0.2020-14.el7 os 36 k
**Transaction Summary
========================================================================================================================================================================**
Install 2 Packages (+8 Dependent packages)
Total download size: 21 M
Installed size: 110 M
Is this ok [y/d/N]: y
Downloading packages:
(1/10): mariadb-5.5.64-1.el7.x86_64.rpm | 8.7 MB 00:00:01
(2/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(3/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(4/10): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00
(5/10): mariadb-server-5.5.64-1.el7.x86_64.rpm | 11 MB 00:00:02
(6/10): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00
(7/10): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(8/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(9/10): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(10/10): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 7.4 MB/s | 21 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Data-Dumper-2.145-3.el7.x86_64 1/10
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 2/10
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/10
Installing : perl-IO-Compress-2.061-2.el7.noarch 4/10
Installing : 1:mariadb-5.5.64-1.el7.x86_64 5/10
Installing : perl-Net-Daemon-0.48-5.el7.noarch 6/10
Installing : perl-PlRPC-0.2020-14.el7.noarch 7/10
Installing : perl-DBI-1.627-4.el7.x86_64 8/10
Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 9/10
Installing : 1:mariadb-server-5.5.64-1.el7.x86_64 10/10
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 1/10
Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 2/10
Verifying : 1:mariadb-5.5.64-1.el7.x86_64 3/10
Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 4/10
Verifying : perl-IO-Compress-2.061-2.el7.noarch 5/10
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 6/10
Verifying : 1:mariadb-server-5.5.64-1.el7.x86_64 7/10
Verifying : perl-DBI-1.627-4.el7.x86_64 8/10
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 9/10
Verifying : perl-PlRPC-0.2020-14.el7.noarch 10/10
Installed:
mariadb.x86_64 1:5.5.64-1.el7 mariadb-server.x86_64 1:5.5.64-1.el7
Dependency Installed:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Complete!
[root@VM_0_12_centos ~]#
2、重启服务并加入到开机启动项
[root@VM_0_12_centos ~]# systemctl start mariadb
[root@VM_0_12_centos ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@VM_0_12_centos ~]#
3、对数据库程序进行初始化操作
[root@VM_0_12_centos ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 当前数据库密码为空,直接按回车键
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password: 输入要为root管理员设置的数据库密码
Re-enter new password: 再次输入密码
Password updated successfully!
Reloading privilege tables…
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y 删除匿名账号
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y 禁止root管理员从远程登录
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y 删除test数据库并取消对它的访问权限
- Dropping test database…
… Success! - Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y 刷新授权表,让初始化后的设定立即生效
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
4、防火墙策略放行对数据库的访问请求(默认为3306端口)
[root@VM_0_12_centos ~]#
[root@VM_0_12_centos ~]# firewall-cmd --permanent --add-service=mysql
success
[root@VM_0_12_centos ~]# firewall-cmd --reload
success
5、首次登录MariaDB数据库,-u用来指定以root管理员的身份登录,-p用来验证该用户在数据库中的密码值, 输入错误的话出现->, \c退回mysql
[root@VM_0_12_centos ~]#
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> SHOW databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
±-------------------+
3 rows in set (0.00 sec)
6、修改root管理员的密码值为666666
MariaDB [(none)]>
MariaDB [(none)]> SET password = PASSWORD(‘666666’);
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
二、管理账号及授权
1、创建新用户herry、密码666666
MariaDB [(none)]> CREATE USER herry@localhost IDENTIFIED BY ‘666666’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
2、查询账号herry的主机名及经过加密的密码值
MariaDB [mysql]> SELECT HOST,USER,PASSWORD FROM user WHERE USER=‘herry’;
±----------±------±------------------------------------------+
| HOST | USER | PASSWORD |
±----------±------±------------------------------------------+
| localhost | herry | *B2B366CA5C4697F31D4C55D61F0B17E70E5664EC |
±----------±------±------------------------------------------+
1 row in set (0.00 sec)
3、发现herry仅仅是个普通用户,没有数据库的人行操作权限
[root@VM_0_12_centos ~]# mysql -u herry -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> SHOW databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
±-------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> exit
Bye
4、针对Mysql数据库中的user表单,用root管理员向账号herry授予查询、更新、删除及插入等权限
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> GRANT SELECT,UPDATE,DELETE,INSERT ON mysql.user TO herry@localhost;
Query OK, 0 rows affected (0.00 sec)
GRANT命令详解:
5、再次查看账号herry的权限,下面显示账号herry已经拥有了针对mysql数据库中user表单的一系列权限了,
MariaDB [mysql]> SHOW GRANTS FOR herry@localhost;
±-------------------------------------------------------------------------------------------------------------+
| Grants for herry@localhost |
±-------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO ‘herry’@‘localhost’ IDENTIFIED BY PASSWORD ‘*B2B366CA5C4697F31D4C55D61F0B17E70E5664EC’ |
| GRANT SELECT, INSERT, UPDATE, DELETE ON mysql
.user
TO ‘herry’@‘localhost’ |
±-------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [mysql]>
MariaDB [mysql]> exit
Bye
[root@VM_0_12_centos ~]# mysql -u herry -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> SHOW DATABASES;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
±-------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> SHOW TABLES;
±----------------+
| Tables_in_mysql |
±----------------+
| user |
±----------------+
1 row in set (0.00 sec)
MariaDB [mysql]> exit
Bye
6、切换回root账户,移除刚才的授权。
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> REVOKE SELECT,UPDATE,DELETE,INSERT ON mysql.user FROM herry@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> SHOW GRANTS FOR herry@localhost;
±-------------------------------------------------------------------------------------------------------------+
| Grants for herry@localhost |
±-------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO ‘herry’@‘localhost’ IDENTIFIED BY PASSWORD ‘*B2B366CA5C4697F31D4C55D61F0B17E70E5664EC’ |
±-------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
三、创建数据库与表单
1、创建一个名为mycollection的数据库,
MariaDB [(none)]> CREATE DATABASE mycollection;
Query OK, 1 row affected (0.00 sec)
2、查看
MariaDB [(none)]> SHOW databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mycollection |
| mysql |
| performance_schema |
±-------------------+
4 rows in set (0.00 sec)
3、在新建的mycollection数据库中创建表单mybook, 然后定义存储数据内容的结构,分别定义了三个字段项(名称、价格、页数)
MariaDB [(none)]> use mycollection;
Database changed
MariaDB [mycollection]> CREATE TABLE mybook (name char(15),price int,pages int);
Query OK, 0 rows affected (0.03 sec)
MariaDB [mycollection]> DESCRIBE mybook;
±------±---------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±------±---------±-----±----±--------±------+
| name | char(15) | YES | | NULL | |
| price | int(11) | YES | | NULL | |
| pages | int(11) | YES | | NULL | |
±------±---------±-----±----±--------±------+
3 rows in set (0.00 sec)
四、管理表单及数据(增、删、改、查)
1、插入一条图书信息,书名为故事会, 价格60元、页码518页
MariaDB [mycollection]> INSERT INTO mybook(name,price,pages) VALUES(‘gushihui’,‘60’,‘518’);
Query OK, 1 row affected (0.00 sec)
MariaDB [mycollection]> SELECT * FROM mybook;
±---------±------±------+
| name | price | pages |
±---------±------±------+
| gushihui | 60 | 518 |
±---------±------±------+
1 row in set (0.00 sec)
2、修改价格为55元。
MariaDB [mycollection]> UPDATE mybook SET price=55 ;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [mycollection]> SELECT name,price FROM mybook;
±---------±------+
| name | price |
±---------±------+
| gushihui | 55 |
±---------±------+
1 row in set (0.00 sec)
MariaDB [mycollection]> SELECT * FROM mybook;
±---------±------±------+
| name | price | pages |
±---------±------±------+
| gushihui | 55 | 518 |
±---------±------±------+
1 row in set (0.00 sec)
3、删除数据表单mybook的内容。
MariaDB [mycollection]> DELETE FROM mybook;
Query OK, 1 row affected (0.00 sec)
MariaDB [mycollection]> SELECT * FROM mybook;
Empty set (0.00 sec)
4、使用insert依次插入4条图书信息。
MariaDB [mycollection]> INSERT INTO mybook(name,price,pages) VALUES(‘gushihui01’,‘30’,‘518’);
Query OK, 1 row affected (0.00 sec)
MariaDB [mycollection]> INSERT INTO mybook(name,price,pages) VALUES(‘gushihui02’,‘50’,‘518’);
Query OK, 1 row affected (0.00 sec)
MariaDB [mycollection]> INSERT INTO mybook(name,price,pages) VALUES(‘gushihui03’,‘80’,‘518’);
Query OK, 1 row affected (0.01 sec)
MariaDB [mycollection]> INSERT INTO mybook(name,price,pages) VALUES(‘gushihui04’,‘100’,‘518’);
Query OK, 1 row affected (0.00 sec)
5、在mybook表单中查找出价格>75元或价格不等于80元的图书
MariaDB [mycollection]> SELECT * FROM mybook WHERE price>75;
±-----------±------±------+
| name | price | pages |
±-----------±------±------+
| gushihui03 | 80 | 518 |
| gushihui04 | 100 | 518 |
±-----------±------±------+
2 rows in set (0.00 sec)
MariaDB [mycollection]> SELECT * FROM mybook WHERE price!=80;
±-----------±------±------+
| name | price | pages |
±-----------±------±------+
| gushihui01 | 30 | 518 |
| gushihui02 | 50 | 518 |
| gushihui04 | 100 | 518 |
±-----------±------±------+
3 rows in set (0.00 sec)
MariaDB [mycollection]> exit
Bye
五、数据库的备份及恢复
1、将mycollection数据库的内容导出成一个文件,并保存到root管理员的家目录。
[root@VM_0_12_centos ~]# mysqldump -u root -p mycollection > /root/mycollectionDB.dump
Enter password:
2、彻底删除mycollection数据库
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> DROP DATABASE mycollection
-> \c
MariaDB [(none)]> DROP DATABASE mycollection;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> SHOW databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
±-------------------+
3 rows in set (0.00 sec)
3、重新建立mycollection数据库
MariaDB [(none)]> CREATE DATABASE mycollection;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> QUIT
Bye
4、恢复数据库文件,
[root@VM_0_12_centos ~]# mysql -u root -p mycollection < /root/mycollectionDB.dump
Enter password:
[root@VM_0_12_centos ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 26
Server version: 5.5.64-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
5、重新登录数据库,就又能看到mycollection数据库及mybook数据表单了,数据库恢复成功!
MariaDB [(none)]> use mycollection
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mycollection]> SHOW tables;
±-----------------------+
| Tables_in_mycollection |
±-----------------------+
| mybook |
±-----------------------+
1 row in set (0.00 sec)
MariaDB [mycollection]> DESCRIBE mybook;
±------±---------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±------±---------±-----±----±--------±------+
| name | char(15) | YES | | NULL | |
| price | int(11) | YES | | NULL | |
| pages | int(11) | YES | | NULL | |
±------±---------±-----±----±--------±------+
3 rows in set (0.00 sec)
六、卸载mariadb, 一定要卸载干净。
[root@VM_0_12_centos ~]# yum remove mariadb mariadb-devel mariadb-server mariadb-libs
Loaded plugins: fastestmirror, langpacks
No Match for argument: mariadb-devel
Resolving Dependencies
–> Running transaction check
—> Package mariadb.x86_64 1:5.5.64-1.el7 will be erased
—> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be erased
–> Processing Dependency: libmysqlclient.so.18()(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
–> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
–> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
–> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
—> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be erased
–> Running transaction check
—> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be erased
—> Package postfix.x86_64 2:2.10.1-7.el7 will be erased
–> Finished Dependency Resolution
epel/7/x86_64 | 4.7 kB 00:00:00
epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
epel/7/x86_64/primary_db | 6.8 MB 00:00:01
extras/7/x86_64 | 2.9 kB 00:00:00
os/7/x86_64 | 3.6 kB 00:00:00
updates/7/x86_64 | 2.9 kB 00:00:00
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Removing:
mariadb x86_64 1:5.5.64-1.el7 @os 49 M
mariadb-libs x86_64 1:5.5.64-1.el7 @os 4.4 M
mariadb-server x86_64 1:5.5.64-1.el7 @os 58 M
Removing for dependencies:
perl-DBD-MySQL x86_64 4.023-6.el7 @os 323 k
postfix x86_64 2:2.10.1-7.el7 @anaconda 12 M
**Transaction Summary
========================================================================================================================================================================**
Remove 3 Packages (+2 Dependent packages)
Installed size: 124 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 1:mariadb-server-5.5.64-1.el7.x86_64 1/5
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
Erasing : 1:mariadb-5.5.64-1.el7.x86_64 2/5
Erasing : perl-DBD-MySQL-4.023-6.el7.x86_64 3/5
Erasing : 2:postfix-2.10.1-7.el7.x86_64 4/5
Erasing : 1:mariadb-libs-5.5.64-1.el7.x86_64 5/5
Verifying : 1:mariadb-libs-5.5.64-1.el7.x86_64 1/5
Verifying : 1:mariadb-5.5.64-1.el7.x86_64 2/5
Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 3/5
Verifying : 1:mariadb-server-5.5.64-1.el7.x86_64 4/5
Verifying : 2:postfix-2.10.1-7.el7.x86_64 5/5
Removed:
mariadb.x86_64 1:5.5.64-1.el7 mariadb-libs.x86_64 1:5.5.64-1.el7 mariadb-server.x86_64 1:5.5.64-1.el7
Dependency Removed:
perl-DBD-MySQL.x86_64 0:4.023-6.el7 postfix.x86_64 2:2.10.1-7.el7
Complete!
[root@VM_0_12_centos ~]# rm -f /etc/my.cnf
[root@VM_0_12_centos ~]# rm -rf /var/lib/mysql/*