当前位置:网站首页>centos7安装mysql笔记

centos7安装mysql笔记

2022-07-07 15:33:00 python与大数据分析

需要部署在centos7的虚拟机上部署mysql,凭空报了很多错,天下文章一大抄,互联网的不严谨在这里暴露无遗,当然我也是走了很多弯路,删了又装,装了又删,在此不做详述了,只保留最终结果。

按照正常文档安装mysql,会报这个错误。

Failed to start mysqld.service: Unit not found

按照一般的说法,重新卸载mysql,安装mariadb同样也会报错

Failed to start mariadb.service: Unit not found

安装之前,还是先解决wget问题

Last login: Wed Jun  ::  from 192.168.3.122
[[email protected] ~]# cd /etc

[[email protected] etc]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
-bash: wget: 未找到命令
[[email protected] local]# yum install wget
已加载插件:fastestmirror
...此处省略字
已安装:
  wget.x86_64 :1.14-18.el7_6.1                                                     
完毕!

再下载rpm包,感觉此处没有必要,不过没测试

[[email protected] etc]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--2022-06-15 ::--  http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
...此处省略字
已安装:
  mysql57-community-release.noarch :el7-10                                         
完毕!

通过yum安装mysql-community-server,此处要添加nogpgcheck


[[email protected] etc]# yum -y install mysql-community-server  --nogpgcheck
已加载插件:fastestmirror
L...此处省略字
已安装:
  mysql-community-server.x86_64 :5.7.38-1.el7                                      
作为依赖被安装:
  mysql-community-client.x86_64 :5.7.38-1.el7                                      
  mysql-community-common.x86_64 :5.7.38-1.el7                                      
  mysql-community-libs.x86_64 :5.7.38-1.el7                                        
完毕!

启动mysql服务,观察状态

[[email protected] etc]# systemctl start  mysqld.service

[[email protected] etc]# systemctl status  mysqld.service  
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 -06-15 :: CST; s ago
     Docs: man:mysqld()
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process:  ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=/SUCCESS)
  Process:  ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=/SUCCESS)
 Main PID:  (mysqld)
   CGroup: /system.slice/mysqld.service
           └─ /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld...
月  :: bogon systemd[]: Starting MySQL Server...
月  :: bogon systemd[]: Started MySQL Server.

[[email protected] etc]# 

最后,谢谢关注,谢谢支持!

原网站

版权声明
本文为[python与大数据分析]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/2042964