203

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.

emilebaizel
  • 4,505
  • 5
  • 27
  • 20
  • 14
    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. – TheDudeAbides Feb 15 '19 at 19:15
  • 2
    Recommendation questions are explicitly off-topic. This question is just spawning a stream of package recommendations. – Quentin Aug 27 '21 at 08:47
  • 1
    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. – B. Shea Sep 28 '21 at 17:20

8 Answers8

261

To install only mysql (client) you should execute

yum install mysql

To install mysql client and mysql server:

yum install mysql mysql-server
Hector Magana
  • 2,635
  • 1
  • 12
  • 3
  • 9
    On a current Fedora system you should use `yum install mariadb` and `yum install mariadb-server`. Fedora replace MySQL with MariaDB. – Christian Berendt Mar 02 '15 at 09:45
  • 2
    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 MySQL` – berniey May 18 '16 at 21:08
  • 5
    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. – berniey Jul 08 '16 at 00:48
  • The question says nothing about distribution used. So, why do you list YUM (only)? – B. Shea Sep 28 '21 at 17:25
141

at a guess:

sudo apt-get install default-mysql-client
Edoardo
  • 4,485
  • 1
  • 27
  • 31
Jon Black
  • 16,223
  • 5
  • 43
  • 42
10

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

sudo apt-get install mariadb-client
rezam
  • 627
  • 1
  • 12
  • 17
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
wagnermarques
  • 140
  • 1
  • 4
  • Install MySQL Client: 1. sudo yum install -y https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 2. sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 3. sudo yum install -y mysql-community-client – Vinoth Ramamoorthy Feb 09 '23 at 05:49
8

Maybe try this:

yum -y groupinstall "MYSQL Database Client"
Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
employeebrian
  • 81
  • 1
  • 1
6
sudo apt-get install mysql-client-core-5.5
xdebug
  • 1,178
  • 12
  • 16
3

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

libin
  • 420
  • 3
  • 7
  • The question says nothing about distribution used. So, why do you list CentOS/YUM (only)? – B. Shea Sep 28 '21 at 17:29
  • 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." – libin Oct 15 '21 at 07:07
  • 1
    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." – B. Shea Oct 15 '21 at 17:13
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.

Mark1
  • 166
  • 1
  • 5