In CentOS7, can not start MySQL - 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

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

Error installing MYSQL 5.7 using Yum

I am beginner in installing mysql using YUM and I have looked into various forums, I don't understand why I am getting the following error.
Loaded plugins: fastestmirror, langpacks
Cannot open: mysql57-community-release-el7-3.10.0-229.el7.x86_64.noarch.rpm.
Skipping.
Nothing to do
I did further analysis by executing following commands but still it didnt work.
sudo rm -f /var/lib/rpm/__*
sudo rpm --rebuilddb -v -v
Some further details:
Linux version: Linux lptxukgcs06 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
The user which I am using has sudo priviledges.
Yum Command: sudo yum localinstall mysql57-community-release-el7-3.10.0-229.el7.x86_64.noarch.rpm
Thank you for your time.
The command for installing RPM packages is:
rpm -ivh mysql57-community-release-el7-3.10.0-229.el7.x86_64.noarch.rpm
or
sudo rpm -ivh mysql57-community-release-el7-3.10.0-229.el7.x86_64.noarch.rpm (root password required)
to uninstall, it is:
sudo rpm -e
And to see if package is installed:
rpm -q
Issue was: The .rpm file should be renamed with your linux server version number after you download from mysql website. Rename the file and execute the command: sudo yum localinstall mysql57-community-release-el7-3.10.0-229.el7.x86_64.noarch.rpm.
You can get the version from linux using: uname -a

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

Processing dependency error when installing MySQL 5.6 on CentOS 6.5

I followed an article here https://www.digitalocean.com/community/tutorials/how-to-install-mysql-5-6-from-official-yum-repositories to install MySQL 5.6 on CentOS.
But when I run:
sudo yum install mysql-community-server
I see following errors:
Error: Package: mysql-community-server-5.6.20-4.el7.x86_64 (mysql56-community)
Requires: systemd
Error: Package: mysql-community-server-5.6.20-4.el7.x86_64 (mysql56-community)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
In fact, no matter how I execute yum install mysql mysql-server, I'll get the same errors. I searched online, but lack of resources mentioned what's wrong with 'systemd' and 'libstdc++.so.6' and how to solve this issue.
Before:
yum install openssh-server wget
yum -y update
List your repos and delete mysql-community...
yum repolist
Install nessary repos:
rpm -ihv http://mirror.yandex.ru/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ihv http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install yum-priorities
Add priority=10 in this files:
vi /etc/yum.repos.d/epel.repo
vi /etc/yum.repos.d/nginx.repo
vi /etc/yum.repos.d/remi.repo
And from new repos installation will be good:
yum install mysql mysql-server
After may be doing this:
chkconfig --levels 235 mysqld on
service mysqld start
/usr/bin/mysql_secure_installation
for each of the libraries you cannot find, simply do a 'yum provides' for it, then install the package
e.g.
yum provides systemd
yum provides libstdc++.so.6
then you would do yum install systemd libstdc++ you may need to do a yum install libstdc++-<version> depending on your search results.

MySQL: Package 'mysql-server' has no installation candidate

This error is being shown whenever I want to install any software via command line.
Even if i try to install softwares which I know are present at the source from where I am downloading.
Below is the full error message i am getting :
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mysql-server' has no installation candidate
It worked for me.
If you have followed all the previous steps successfully and after running sudo apt-get install mysql-server you are getting an error then try this
sudo apt-get install mariadb-server
I experienced this issue when trying to install MySQL Server on Debian 10.
Here's how I fixed it:
The issue is caused by the MySQL server apt repository not being included in your system's software repository list. In Debian 10 for example, MariaDB, a community fork of the MySQL project, is packaged as the default MySQL variant.
So to fix this first, add the MySQL server apt repository to your system's software repository list. Follow these steps:
Go to the download page for the MySQL APT repository at:
https://dev.mysql.com/downloads/repo/apt/
Select and download the release package for your Linux distribution. You can use:
sudo wget https://the-download-link
In my case it was:
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Install the downloaded release package with the following command, replacing version-specific-package-name with the name of the downloaded package (preceded by its path, if you are not running the command inside the folder where the package is):
sudo dpkg -i version-specific-package-name.deb
In my case it was:
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Note: dpkg is used to install, remove, and inspect .deb software packages. The -i flag indicates that we’d like to install from the specified file.
During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. The defaults will add the repository information for the latest stable version of MySQL and nothing else. This is what we want, so use the down arrow to navigate to the Ok menu option and hit ENTER.
You'll also be asked to select a repository to add. Choose 'debian buster' which has the package 'mysql-server' in it. After the adding this repository you can update the repository and use the below command to install MySQL.
sudo apt-get install mysql-server
The package will now finish adding the repository. Refresh your apt package cache to make the new software packages available:
sudo apt update
Note: If you ever need to update the configuration of these repositories, just run sudo dpkg-reconfigure mysql-apt-config, select new options, and then sudo apt-get update to refresh your package cache.
Install MySQL by the following command:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Note: This installs the package for the MySQL server, as well as the packages for the client and for the database common files. During the installation, you are asked to supply a password for the root user for your MySQL installation.
The MySQL server is started automatically after installation. You can check the status of the MySQLserver with the following command:
sudo service mysql status
Stop the MySQL server with the following command:
sudo service mysql stop
To restart the MySQL server, use the following command:
sudo service mysql start
MySQL creates a default user called root. You can change the password to any password of your choice by logging in to MySQL console using socket authentication:
sudo mysql -u root
Then run the command below to change the password
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'your-preferred-password';
Reference:
A Quick Guide to Using the MySQL APT Repository
How To Install the Latest MySQL on Debian 10
That's all.
I hope this helps
You can install mysql by
sudo apt install default-mysql-server
--------
sudo service mysql status
● mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 13:19:33 +08; 33s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 18537 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 4915)
Memory: 73.1M
CGroup: /system.slice/mariadb.service
└─18537 /usr/sbin/mysqld
run:
apt install default-mysql-server
which installs MariaDB unfortunately, but still responds to service mysql status
Most likely you are running on ubuntu. It is important to run apt-get update first.