CentOS 7 安装 mysql-server 爬坑

发现问题

在centos 6安装 mysql-server是直接使用命令 yum -y install mysql-server ,但是在CentOS 7中出现了 No package mysql-server available. Error: Nothing to do 错误。详细错误信息如下:

[root@laona ~]# yum -y install mysql-server
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
No package mysql-server available.
Error: Nothing to do

解决方案

使用 MariaDB 代替 MySQL 命令即可

产生原因

简单来说,MariaDB 是 MySQL 的fork,两者关系就好比 Red Hat 和 CentOS 的关系。从 MySQL 变成了 Oracle 甲骨文公司的产品后,MySQL 就已经从 RHEL 和 CentOS 所提供的套件清单移除了。

安装 MySQL

1. 安裝 mariadb 与 mariadb-server 套件

sudo yum -y install mariadb mariasb-client

2. 启动 MySQL 服务

sudo systemctl start mariadb

3. 启动 MariaDB 服务,让 MariaDB 服务每次开机会自启

sudo systemctl enable mariadb

4. 检查启动状态

sudo systemctl status mariadb

5. 加强 MariaDB 安装的安全性

sudo mysql_secure_installation

这个shell主要是有以下作用:

- 设定 root 账号的密码

- 禁止 root 丛非本人登录

- 移除 anonymous 匿名用户登录

- 移除测试数据库

6. 查询版本号

mysql -v

登录测试

键入以下指令,输入密码即可。

mysql -u root -h localhost -p

最新文章

  1. 决策树及R语言实现
  2. C++ static
  3. Azure ARM (8) ARM Template - VS Code
  4. springmvc Failed to load resource: the server responded with a status of 404 (Not Found)
  5. webApp--cordova 系列1
  6. sql语句(mysql)
  7. yii2.0 DetailView 自定义样式
  8. 定时任务处理-Quartz
  9. PL/SQL Developer编码格式设置及中文乱码解决方案
  10. JS之正则表达式验证URL
  11. linux elinks命令
  12. gcc Build-in functions
  13. 自动化测试基础篇--Selenium单选框(Radio)复选框(CheckBox)
  14. Redis 主从配置(Windows版)
  15. day14 Python集合
  16. 递归回溯groupSum
  17. [nginx]站点目录及文件访问控制
  18. Redis 十分钟快速入门
  19. Ubuntu Eclipse ns3编译中 遇到的OSError 系列问题
  20. AE和Mocha结合做视频后期制作

热门文章

  1. 7月17日刷题记录 分治Getting!循环比赛日程表
  2. nginx服务无法停止(Windows)
  3. Excel大数据排查重复行内容方法,三步搞定!
  4. python 快速创建字典 fromkes()
  5. python sys.modules 和 sys.path 及 __name__
  6. 【python系统学习07】一张图看懂字典并学会操作
  7. chrome最耐看的主题
  8. Redis(六):list/lpush/lrange/lpop 命令源码解析
  9. 填充区域 (Populating an Area) | 使用区域 | 高级路由特性 | 精通ASP-NET-MVC-5-弗瑞曼
  10. Python读取字典(Dictionary)内数据的方法