Is there a way to only install the mysql client (Linux)? [closed]
Asked Answered
B

8

209

Are there are any Linux mysql command line tools that don't require the entire mysql db installation package to be installed?

What I'm trying to do is from server #1 (app server), execute mysql commands that will get executed on server #2 (db server). I do not want to run the db on the local server or to install the full blown mysql db.

Benco answered 13/3, 2011 at 3:32 Comment(3)
This is a totally valid question, the answers below are totally relevant, and they totally solve the problem that I had, even if they're only from the perspective of one specific Linux distro (e.g. yum = RedHat / CentOS and apt = Debian / Ubuntu). So I have an edit to make the question more "Q-and-A-like" in the review queue that I would appreciate if someone could approve.Shell
Recommendation questions are explicitly off-topic. This question is just spawning a stream of package recommendations.Washable
This is a 10+ year old question, but still unedited and weak. A question needs to be much more specific. Foremost problem on this one: What distribution of Linux? ANY question asking "what do I do under Linux .." should be edited. The answers you will get will tend to be equally as vague, hit & miss and will mention things that are distro specific such as YUM, APT, DNF, PKG along w/ various repo filenames. You can't get a good, specific answer without a good question.Brae
S
264

To install only mysql (client) you should execute

yum install mysql

To install mysql client and mysql server:

yum install mysql mysql-server
Scutcheon answered 12/11, 2012 at 23:33 Comment(4)
On a current Fedora system you should use yum install mariadb and yum install mariadb-server. Fedora replace MySQL with MariaDB.Monomial
This answer is incorrect. yum install mysql will install the server component as it will try to install mariadb: mariadb.x86_64 : A community developed branch of MySQLLaveta
You should consider using mariadb-client instead. See mariadb.com/kb/en/mariadb/yum for detail instructions. In short, you need to 1) Add mariadb repo for yum. 2) run yum install MariaDB-client. That's it (assuming you are using RH or CentOS). For ubuntu, see answer from Jon Black.Laveta
The question says nothing about distribution used. So, why do you list YUM (only)?Brae
M
153

at a guess:

sudo apt-get install default-mysql-client
Mandolin answered 13/3, 2011 at 4:14 Comment(6)
Use this if you're on Ubuntu.Pagination
or Debian based distrosHowerton
sudo apt-get install default-mysql-client if you are struggling.Godfearing
The question says nothing about distribution used. So, why do you list APT (only)?Brae
Is it only me getting E: Package 'mysql-client' has no installation candidate ? ( I run the update command first and still getting this )Competition
If you're on Amazon Linux 2023 it worked for me by doing sudo yum install mariadb105 Since this will go out of date, you can also search for the latest packages with sudo yum search mysqlLambskin
M
10

If mysql-client is not available, you may use mariadb-client:

sudo apt-get install mariadb-client
Mistrial answered 2/9, 2021 at 7:0 Comment(0)
S
9
[root@localhost administrador]# yum search mysql | grep client
community-mysql.i686 : MySQL client programs and shared libraries
                            : client
community-mysql-libs.i686 : The shared libraries required for MySQL clients
root-sql-mysql.i686 : MySQL client plugin for ROOT
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
[root@localhost administrador]# yum install  -y community-mysql
Sonata answered 26/6, 2014 at 17:10 Comment(1)
Install MySQL Client: 1. sudo yum install -y dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 2. sudo rpm --import repo.mysql.com/RPM-GPG-KEY-mysql-2022 3. sudo yum install -y mysql-community-clientSelfaggrandizement
P
8

Maybe try this:

yum -y groupinstall "MYSQL Database Client"
Ploce answered 29/8, 2013 at 17:1 Comment(0)
E
6
sudo apt-get install mysql-client-core-5.5
Ehrman answered 28/11, 2012 at 13:59 Comment(0)
I
5

there are two ways to install mysql client on centOS.

1. First method (download rpm package)

download rpm package from mysql website https://downloads.mysql.com/archives/community/ enter image description here

if you download this rpm package like picture, it's filename like mysql-community-client-8.0.21-1.el8.x86_64.rpm.

then execute sudo rpm -ivh --nodeps --force mysql-community-client-8.0.21-1.el8.x86_64.rpm can install the rpm package the parameters -ivh means install, print output, don't verify and check.

if raise error, maybe version conflict, you can execute rpm -pa | grep mysql to find conflicting package, then execute rpm -e --nodeps <package name> to remove them, and install once more.

finnaly, you can execute which mysql, it's success if print /usr/bin/mysql.

2.Second method (Set repo of yum)

Please refer to this official website:

MySQL Yum Repository

A Quick Guide to Using the MySQL Yum Repository

Intramuscular answered 29/9, 2020 at 9:32 Comment(4)
The question says nothing about distribution used. So, why do you list CentOS/YUM (only)?Brae
cause I only used RHEL as the server, and it is a general tutorial, which contains the steps to select other Linux versions. "Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime."Intramuscular
This answer is not a 'general tutorial'. It's distribution specific for a rpm installer (or) yum package managers. How does that answer the OP? OP didn't clarify what the distro is as I already mentioned. So, how do you know these are answers that will work for them? A bad question only elicits unspecific/bad answers. The BEST answer in this case is, "install a distribution specific mysql-client and edit your question to be more specific if you want a more specific answer."Brae
This is a good answer. Especially when/if using rpm. The one 'gotcha' would be finding missing dependencies (maybe) during the rpm installation process.Funiculus
F
1

When I now just use the command: mysql

I get: Command 'mysql' not found, but can be installed with:

sudo apt install mysql-client-core-8.0 # version 8.0.22-0ubuntu0.20.04.2, or sudo apt install mariadb-client-core-10.3 # version 1:10.3.25-0ubuntu0.20.04.1

Very helpfull.

Fairminded answered 1/12, 2020 at 11:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.