Error "Failed to start mariadb.service: Unit mariadb.service not found" - mysql

I'm using Fedora 29.
I'm try to run mariadb.service with command: systemctl start mariadb, and give error: Failed to start mariadb.service: Unit mariadb.service not found.
Also, I tried next commands:
systemctl status mariadb
Unit mariadb.service could not be found.
systemctl start mariadb.service
Failed to start mariadb.service: Unit mariadb.service not found.
systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.
systemctl enable mariadb
Failed to enable unit: Unit file mariadb.service does not exist.
systemctl daemon-reload
<nothing to output>
I trying this with sudo and without. The result is same.
mariadb-server is installed:
dnf install mariadb-server
Package mysql-community-server-8.0.15-1.fc29.x86_64 already installed.
Just starting to use Linux, I can not understand what's the trouble.

You have MySQL 8 installed which is why your installation of MariaDB failed: the two conflict and you must pick which one you want.
If you want to install MariaDB, you first have to uninstall MySQL 8 first:
dnf remove mysql-community-server
dnf install mariadb-server
Historically, both MySQL and MariaDB used to use mysql as the service name. The MySQL 8 package uses only the mysql service name whereas MariaDB has both mariadb and mysql services, the latter being an alias to the mariadb one.
MariaDB added its own service name quite early on in the 10 series of releases and has added aliases for other commands as well. For example, the mariadb command is the same program as the mysql command in MariaDB 10.5.

It was quite confusing to me too. I followed several instructions found online but it seems that even talking about the same version 5.5 there are quite a few different ways to start the service after installation. I finally accidentally tried mysql and it worked.
when seeing this after a successful installation:
Installed: MariaDB-server.x86_64 0:5.5.67-1.el7.centos
Dependency Installed: MariaDB-client.x86_64 0:5.5.67-1.el7.centos
Complete!
and I tried:
$ sudo systemctl start mariadb
Failed to start mariadb.service: Unit not found.
and I tried:
$ sudo systemctl start mysql
there was a silence.
and I tried:
$ sudo systemctl status mysql
It said it's active(running).

you can use rpm -ql mysql-community-server-8.0.15-1 in order to find where the package is installed. then you can find executables from this path and try to run it

Related

How to go to mysql database host on Linux CLI in RedHat 8

I installed mariadb using
# yum install mariadb mariadb-sever
Then on running:
# systemctl start mariadb
I got:
# Failed to start mariadb.service: Unit mariadb.service not found
& on running:
# systemctl restart mysqld
I got:
# Failed to restart mysql.service: Unit mysql.service not found
Simply install, activate at boot + start mysql executable :
yum install mariadb mariadb-server
systemctl enable --now mariadb.service
You need to:
yum install mariadb mariadb-server
mariadb-server package contains the server daemon
mariadb package contains the CLI client

Problems installing MySQL 5.7 properly on fresh CentOS 7 install

I admit that I am new to back-end work in general and I seem to be stuck (for several hours) following through with completing the setting up process for Magento 2.3
I was following https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html for my commands but to no success.
I managed to get the following installed:
Cent OS 7 (x86_64)
Apache 2.4.6
PHP 7.2.14 (all the extensions installed passed the Setup Wizard readiness check)
I used these commands to install MySQL 5.7 Community Release: (from the documentation)
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql mysql-server
yum -y install mysql-community-server
To check if my installation went well, when I run:
mysql --version
I received an error message saying:
-bash: /usr/bin/mysql: No such file or directory
I know that there is something I definitely am missing out completely. When I try to start the MySQL service using the command:
systemctl start mysqld
I get the resulting error message:
Failed to start mysqld.service: Unit not found.
Any suggestions will much be appreciated. Thank you in advance.
Maybe it installed it as mariadb?
systemctl start mariadb
After removing MySQL 5.7 community release from my Cent OS, I decided to install MariaDB.
Inside the directory /etc/yum.repos.d/ I've created a file called MariaDB.repo and added this into the file:
# MariaDB 10.3 CentOS repository list - created 2019-01-25 05:36 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
I then performed the command in my terminal window:
sudo yum install MariaDB-server MariaDB-client
Because of this, mysql --version and systemctl start mysql works like a charm. Thanks #greenberet123 and #danblack for the suggestion.

mysql.sock does not exist error in fresh install of MySQL on Arch Linux

I'm trying to use MySQL on Arch Linux. it is already installed but this error comes up when I try to connect:
connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")'
I've looked for /etc/my.cfg but the file does not exist.
Something must have gone wrong during the installation.
How can I "purge" MariaDB and reinstall it?
If you're using archlinux it is a vital idea to understand the package manager (pacman). For the question about /etc/my.cfg you can run
pacman -Ql mariadb
there you will see that the file is actually called:
/etc/mysql/my.cnf
Arch linux will not configure the package for you, that is part of the arch philosophy. It will provide example configurations, and even provide you with a systemd unit file
usr/lib/systemd/system/mysqld.service
but it is your responsibility to ensure that the configuration is correct and actually start the daemon.
systemctl enable mysqld # add the unit file to the boot sequence
systemctl start mysqld # runs ExecStart= in the unit file
systemctl stop mysqld # kills the daemon
systemctl disable mysqld # remove unit from boot sequence
reinstall
Since the word reinstall is in the title of the question and someone might find this question thanks to that: To reinstall mariadb you simply do
pacman -S mariadb
pacman will reinstall a package that is already installed, there is no need to remove the package (for completeness, package removal happens with pacman -R)
as of 7-28-17 I had to do this on a new install. Newbie here might save someone some time. It was a real pain.
OK HERE IS THE DEAL!!!!!
INSTALL APACHE _ NO PROB
INSTALL MYSQL _PROBLEM
pacman -S mysql then before starting service
MUST UNCOMMENT INNODB IN:
nano /etc/mysql/my.cnf
then must initialize datadirectory before starting service:
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
You need to initialize the MariaDB data directory prior to starting
the service. This can be done with mysql_install_db command, e.g.:
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Optional dependencies for mariadb
galera: for MariaDB cluster with Galera WSREP
perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and
mysql_setpermission
CNF file is /etc/mysql/my.cnf in Arch Linux.
One simple way I can reproduce your issue is when MariaDB is shut down. Sorry if it sounds dumb but as you did not mention it: is MariaDB started? sudo systemctl start mysqld.service
You should have a look at MariaDB logs to get some clue: journalctl _SYSTEMD_UNIT=mysqld.service (maybe paste some part if you still don't get what is going on).
This happens the first time you install MySQL and MariaDB. As grochmal pointed out, you have to set up configurations before first use. But, the user teckk sent these three links in the archlinux newbie corner:
https://wiki.archlinux.org/index.php/MariaDB
https://wiki.archlinux.org/index.php/MariaDB#Reset_the_root_password
https://bbs.archlinux.org/viewtopic.php?id=51981
In short, you have to run the command below before starting the service:
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Optionally (recommended) you should improve the initial security by calling:
sudo mysql_secure_installation
Now you can start the service:
sudo systemctl start mariadb
Optionally, you could install and use a graphical front-end tool.
Carry on with setting up the configurations as described in the archwiki post on MariaDB Configuration.

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?
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
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)
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
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:~>
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

Maria DB (mysql) installation on Red Hat . How do I start service after installation

I have installed mysql (maria db) on redhat.
My question is - how do I start and stop the server?
STEPS
I ran the command
$sudo yum install mysql
It gave long messages in the console while installing and and at the end said
Installed:
mariadb.x86_64 1:5.5.41-2.el7_0
Dependency Installed:
perl.x86_64 4:5.16.3-285.el7 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-2.el7
perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-285.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-3.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-285.el7 perl-macros.x86_64 4:5.16.3-285.el7 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7
But now when I run the command
$ sudo service mysql start
it gives messages
Redirecting to /bin/systemctl start mysql.service Failed to issue
method call: Unit mysql.service failed to load: No such file or
directory.
I am using Red hat version - Red Hat Enterprise Linux Server release 7.1 (Maipo)
I believe you've installed only the client. For the server do yum install mariadb-server. The package will install appropriate service file for you.
The name of the service though is mariadb. Well that is the case on CentOS 7 at least... So, after you install mariadb-server package do systemctl enable mariadb and systemctl start mariadb.
The service is called mysqld, not mysql. So:
$ service mysqld start
Or better yet, use the proper systemd syntax:
$ systemctl start mysqld