In CentOS7, can not start MySQL

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

[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?

1

5 Answers

when you run

yum install mysql

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

yum list installed | grep mariadb

if mariadb-server is missing try this following command

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

1

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)
3

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

service mysql_service_name start

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

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.

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/ to /usr/lib/systemd/system/mariadb.service.
root@ol7-101:~>

CentOS7 use mariaDB replaced Mysql, you can use mariaDB as same as Mysql. Or you can download repo from mysql.com. And then you can install mysql

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like