异常:Failed to start mysql.server.service: Unit not found.
[root@fa35eaa48320 /]# service mysql start
Redirecting to /bin/systemctl start mysql.service
Failed to start mysql.service: Unit not found.
解决方法如下:
首先需要安装mariadb-server
[root@fa35eaa48320 /]# yum install -y mariadb-server
启动服务
[root@fa35eaa48320 /]# systemctl start mariadb.service
添加到开机启动
[root@fa35eaa48320 /]# systemctl enable mariadb.service
原因:
MariaDB代替了mysql数据库,MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。
如果你按上述操作后:
[root@fa35eaa48320 /]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 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 tables;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
这里可以看出MariaDB 就是mysql