MySQL CentOS7下,无法启动MySQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31067135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In CentOS7, can not start MySQL
提问by user3118508
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。我怎么解决这个问题?
回答by john maxwell
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
我的问题就这样解决了。谢谢
回答by zirf
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)
回答by Maciej Asembler
Check /etc/init.d/ for your mysql service name and then
检查 /etc/init.d/ 以获取您的 mysql 服务名称,然后
service mysql_service_name start
服务 mysql_service_name 开始
On centos it is either: service mysqld startor for MariaDB: service mariadb start
在 centos 上,它是: service mysqld start或 MariaDB: service mariadb start
回答by RgnKjnVA
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 然后安装 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:~>