Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In CentOS7, can not start MySQL

Tags:

mysql

centos

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?

like image 855
user3118508 Avatar asked Jun 26 '15 07:06

user3118508


People also ask

How to start MySQL on CentOS 7?

Start MySQL and Check its Status Once you have MySQL ready on CentOS 7, it does not automatically start right after the installation. Therefore, you need to start it manually through the following command: sudo systemctl start mysqld

How do I install MySQL on Ubuntu?

Install MySQL 1 Use the following yum install command to install MySQL: sudo yum install mysql-server 2 The script will return with a list of packages and ask you for confirmation to download and install them. Type y and press ENTER for each of the requests. 3 You’ll need to do this a few times, but you’ll eventually see the Complete! ...

How do I start MariaDB on CentOS?

On centos it is either: service mysqld start or for MariaDB: service mariadb start This function worked after logging in from super admin. Thanks! 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.

How to fix SELinux is not working in MySQL?

Reinstalling MySQL might help. then Install. Had the same problem. to check if SELinux policy is causing the issue. If so, first check if SELinux policy is enables using command #sestatus. If it shows enabled, than disable it. Uninstall and reinstall mysql.


4 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

like image 104
john maxwell Avatar answered Oct 20 '22 05:10

john maxwell


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)
like image 25
zirf Avatar answered Oct 20 '22 05:10

zirf


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

service mysql_service_name start

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

like image 42
Maciej Asembler Avatar answered Oct 20 '22 04:10

Maciej Asembler


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/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
root@ol7-101:~>
like image 25
RgnKjnVA Avatar answered Oct 20 '22 03:10

RgnKjnVA