在CentOS7中,无法启动MySQL

ghhkc1vu  于 2023-02-04  发布在  Mysql
关注(0)|答案(6)|浏览(221)

我想在CentOS7上使用MySQL。使用百胜安装MySQL包。

[root@node01 ~]# yum install mysql mysql-*

然后,

[root@node01 ~]# systemctl start mysqld.service
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.

我无法执行MySQL。我该如何解决这个问题?

4xrmg8kj

4xrmg8kj1#

当你跑的时候

yum install mysql

命令默认情况下,它安装mariadb而不是mysql。因此请尝试以下命令

yum list installed | grep mariadb

如果mariadb-server丢失,请尝试以下命令

yum install mariadb-server

它将安装服务器软件包,然后启动服务

systemctl start mariadb

service mariadb start

我的问题就这样解决了,谢谢

hc2pp10m

hc2pp10m2#

要检查所需的软件包,请键入给定的命令:

$ rpm -qa | grep mariadb
    • 输出**:
mariadb-libs-5.5.44-2.el7.centos.x86_64
    mariadb-5.5.44-2.el7.centos.x86_64
    mariadb-devel-5.5.44-2.el7.centos.x86_64
    mariadb-server-5.5.44-2.el7.centos.x86_64

如果最后一个软件包不存在,请键入给定的命令:

$ sudo yum -y install mariadb-server

$ sudo systemctl start mariadb

$ cat /etc/redhat-release
    • 输出**:
CentOS Linux release 7.2.1511 (Core)
kcrjzv8t

kcrjzv8t3#

在/etc/init.d/中查找mysql服务名称,然后
服务mysql服务名启动
在centos上,它是:服务mysqld启动或对于MariaDB:服务mariadb启动

ghg1uchk

ghg1uchk4#

mysql-community-common似乎是与基于Red Hat的 *nix v7沿着安装的,它反过来又与mariadb安装冲突。我使用的是Oracle Linux 7,刚刚遇到了这个问题。在全新安装OL 7后,安装了mysql-community-common和mysql-community-libs。删除mysql-community-common,然后安装mariadb,一切都像冠军一样工作。

root@ol7-101:~> yum list installed | grep mysql
mysql-community-common.x86_64       5.6.27-2.el7                   @Server-Mysql/7.2
mysql-community-libs.x86_64         5.6.27-2.el7                   @Server-Mysql/7.2
root@ol7-101:~>

root@ol7-101:~> yum install mariadb-server mariadb -y
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check    
[...]

86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
  file /usr/share/mysql/spanish/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
  file /usr/share/mysql/swedish/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
  file /usr/share/mysql/ukrainian/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
  file /usr/share/mysql/errmsg-utf8.txt from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64

Error Summary
-------------

root@ol7-101:~> systemctl start mariadb
Failed to start mariadb.service: Unit mariadb.service failed to load: No such file or directory.

root@ol7-101:~> systemctl enable mariadb.service
Failed to execute operation: Access denied
root@ol7-101:~>

root@ol7-101:~> yum erase mysql-community-common.x86_64
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-common.x86_64 0:5.6.27-2.el7 will be erased
--> Finished Dependency Resolution
[...]    

root@ol7-101:~> yum install mariadb  mariadb-libs mariadb-server -y
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check    
[...]

Complete!

root@ol7-101:~> systemctl start mariadb.service
root@ol7-101:~>
root@ol7-101:~> systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
root@ol7-101:~>
7jmck4yq

7jmck4yq5#

CentOS7使用mariaDB代替了Mysql,你可以像使用Mysql一样使用mariaDB。或者你可以从mysql.com下载repo。然后安装mysql

t3irkdon

t3irkdon6#

我在Centos 7上重新安装Mysql后遇到了这个问题。我需要Mysql 8-而不是MariaDB。
我已经使用了回购协议:

https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

我看到:

yum list installed mysql\*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.icm.edu.pl
 * epel: mirror.vpsnet.com
 * extras: ftp.icm.edu.pl
 * remi-php81: mirror.23m.com
 * remi-safe: mirror.23m.com
 * updates: ftp.icm.edu.pl
Installed Packages
mysql80-community-release.noarch                                                                                                                                       el7-3                                                                                                                                        installed

但Mysql服务未启动:

sudo systemctl start mysqld
Failed to start mysqld.service: Unit not found.

相关问题