在CentOS7中,无法启动MySQL

时间:2021-09-04 20:52:27

I want use MySQL on CentOS7. installed MySQL package using yum.

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

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

then,

然后,

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

i can not execute MySQL. How can i solve this problem?

我无法执行MySQL。我怎么解决这个问题?

4 个解决方案

#1


10  

To check for the required packages, type the given command:

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

$ rpm -qa | grep mariadb

Output:

输出:

    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

If the last package is absent, type the given commands:

如果缺少最后一个包,请键入给定的命令:

$ sudo yum -y install mariadb-server

$ sudo systemctl start mariadb

$ cat /etc/redhat-release

Output:

输出:

CentOS Linux release 7.2.1511 (Core)

#2


9  

when you run

当你跑步

yum install mysql

command by default it installs mariadb not mysql. so try this following command

命令默认情况下安装mariadb而不是mysql。所以尝试以下命令

yum list installed | grep mariadb

if mariadb-server is missing try this following command

如果缺少mariadb-server,请尝试以下命令

yum install mariadb-server

it installs the server package then start the service

它安装服务器包然后启动服务

systemctl start mariadb

or

要么

service mariadb start

My issue is solved in this way. Thanks

我的问题以这种方式解决了。谢谢

#3


3  

Check /etc/init.d/ for your mysql service name and then

检查/etc/init.d/以获取您的mysql服务名称

service mysql_service_name start

service mysql_service_name start

On centos it is either: service mysqld start or for MariaDB: service mariadb start

在centos上它是:service mysqld start或MariaDB:service mariadb start

#4


1  

mysql-community-common appears to be installed along with Red Hat-based *nix v7 installs and it in turn conflicts with mariadb installation. I'm using Oracle Linux 7, just ran into this. After a fresh install of OL7, mysql-community-common and mysql-community-libs are installed. Remove mysql-community-common THEN install mariadb and everything works like a champ.

mysql-community-common似乎与基于Red Hat的* nix v7安装一起安装,反过来又与mariadb安装冲突。我正在使用Oracle Linux 7,只是遇到了这个问题。在全新安装OL7之后,安装了mysql-community-common和mysql-community-libs。删除mysql-community-common THEN install 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:~>

#1


10  

To check for the required packages, type the given command:

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

$ rpm -qa | grep mariadb

Output:

输出:

    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

If the last package is absent, type the given commands:

如果缺少最后一个包,请键入给定的命令:

$ sudo yum -y install mariadb-server

$ sudo systemctl start mariadb

$ cat /etc/redhat-release

Output:

输出:

CentOS Linux release 7.2.1511 (Core)

#2


9  

when you run

当你跑步

yum install mysql

command by default it installs mariadb not mysql. so try this following command

命令默认情况下安装mariadb而不是mysql。所以尝试以下命令

yum list installed | grep mariadb

if mariadb-server is missing try this following command

如果缺少mariadb-server,请尝试以下命令

yum install mariadb-server

it installs the server package then start the service

它安装服务器包然后启动服务

systemctl start mariadb

or

要么

service mariadb start

My issue is solved in this way. Thanks

我的问题以这种方式解决了。谢谢

#3


3  

Check /etc/init.d/ for your mysql service name and then

检查/etc/init.d/以获取您的mysql服务名称

service mysql_service_name start

service mysql_service_name start

On centos it is either: service mysqld start or for MariaDB: service mariadb start

在centos上它是:service mysqld start或MariaDB:service mariadb start

#4


1  

mysql-community-common appears to be installed along with Red Hat-based *nix v7 installs and it in turn conflicts with mariadb installation. I'm using Oracle Linux 7, just ran into this. After a fresh install of OL7, mysql-community-common and mysql-community-libs are installed. Remove mysql-community-common THEN install mariadb and everything works like a champ.

mysql-community-common似乎与基于Red Hat的* nix v7安装一起安装,反过来又与mariadb安装冲突。我正在使用Oracle Linux 7,只是遇到了这个问题。在全新安装OL7之后,安装了mysql-community-common和mysql-community-libs。删除mysql-community-common THEN install 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:~>