2015-06-26 22 views
9

Tôi muốn sử dụng MySQL trên CentOS7. cài đặt gói MySQL bằng yum.Trong CentOS7, không thể khởi động MySQL

[[email protected] ~]# yum install mysql mysql-* 

sau đó,

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

tôi không thể thực hiện MySQL. Làm thế nào tôi có thể giải quyết vấn đề này?

+0

Tôi nghĩ bạn phải sử dụng MariaDB thay vì MySql. –

Trả lời

3

Kiểm tra /etc/init.d/ cho tên dịch vụ mysql của bạn và sau đó

dịch vụ mysql_service_name bắt đầu

On centos nó là một trong hai: dịch vụ mysqld bắt đầu hoặc cho MariaDB: dịch vụ mariadb bắt đầu

10

Để kiểm tra các gói cần thiết, hãy nhập lệnh đã cho:

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 

Nếu gói cuối cùng vắng mặt, gõ các lệnh đưa ra:

$ sudo yum -y install mariadb-server 

$ sudo systemctl start mariadb 

$ cat /etc/redhat-release 

Output:

CentOS Linux release 7.2.1511 (Core) 
+0

Tôi cũng có cùng một cấu hình, nhưng không có phương pháp nào được đề cập đang hoạt động.Tôi nhận được lỗi này khi cài đặt mariadb-server từ lệnh trên, 'Gói 1: mariadb-server-5.5.50-1.el7_2.x86_64 bị lỗi thời bởi mysql-community-server-5.7.16-1.el7.x86_64 đã được cài đặt Không có gì để làm'. Tôi có thể làm gì?? –

1

mysql-cộng đồng chung dường như được cài đặt cùng với cài đặt * nix v7 dựa trên Red Hat và nó lần lượt xung đột với cài đặt mariadb. Tôi đang sử dụng Oracle Linux 7, chỉ cần chạy vào điều này. Sau khi cài đặt OL7 mới, mysql-community-common và mysql-community-libs được cài đặt. Hủy bỏ mysql-cộng đồng-phổ biến THEN cài đặt mariadb và tất cả mọi thứ hoạt động như một nhà vô địch.

[email protected]:~> 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 
[email protected]:~> 

[email protected]:~> 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 
------------- 

[email protected]:~> systemctl start mariadb 
Failed to start mariadb.service: Unit mariadb.service failed to load: No such file or directory. 

[email protected]:~> systemctl enable mariadb.service 
Failed to execute operation: Access denied 
[email protected]:~> 

[email protected]:~> 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 
[...]  

[email protected]:~> yum install mariadb mariadb-libs mariadb-server -y 
Loaded plugins: ulninfo 
Resolving Dependencies 
--> Running transaction check  
[...] 

Complete! 

[email protected]:~> systemctl start mariadb.service 
[email protected]:~> 
[email protected]:~> systemctl enable mariadb.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. 
[email protected]:~> 
9

khi bạn chạy

yum install mysql 

lệnh theo mặc định nó cài đặt mariadb không mysql. vì vậy hãy thử này lệnh sau

yum list installed | grep mariadb 

nếu mariadb-server là mất tích thử lệnh sau

yum install mariadb-server 

nó cài đặt các gói máy chủ sau đó bắt đầu dịch vụ

systemctl start mariadb 

hoặc

service mariadb start 

Vấn đề của tôi được giải quyết theo cách này. Cảm ơn

Các vấn đề liên quan