Is it possible to install only mysqldump on macOS without MySQL itself.
I'm using MySQL db via Docker, but can't dump the DB from my local machine via MySQL Workbench.
/Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump is version 5.7.17, but the MySQL Server to be dumped has version 5.7.20.
Do you have any suggestions on how to fix that and be able to make dumps from my local machine.
MySQL for macOS is available in a number of different forms: Native Package Installer, which uses the native macOS installer (DMG) to walk you through the installation of MySQL. For more information, see Chapter 2, Installing MySQL on macOS Using Native Packages. You can use the package installer with macOS.
Brew now also has package mysql-client
, so you don't need to install the full mysql
package just in order to get tools like mysqldump
; It's sufficient to run brew install mysql-client
.
You should pay attention on the post-installation notice:
mysql-client is keg-only, which means it was not symlinked into /usr/local, because conflicts with mysql.
If you need to have mysql-client first in your PATH run:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
Otherwise, you would need to use binary directly located at /usr/local/opt/mysql-client/bin/mysqldump
.
See Eriks answer for the new mysql-client package: brew install mysql-client
The latest mysql 5.7 can be installed via brew
.
brew install [email protected]
It takes up about 253MB + 19MB for openssl.
You can remove the server components and cruft manually to get the size down to 127MB
cd /usr/local/Cellar/mysql/5.7.20/ rm -f bin/mysqld bin/mysqld_* lib/libmysqld.a bin/*_embedded
Brew doesn't allow arbitrary package versions to be installed. Some packages do offer MINOR version installs like [email protected]
but you will get the latest from that series.
If you have previously installed a version though (and haven't run brew cleanup
) it can be switched back to with brew switch
.
brew info mysql brew switch mysql 5.7.20
On Linux, you should be able to install the mysql-client package (which includes mysqldump, mysql, mysqladmin, etc.) without the mysql-server. You'd have to install the mysql-shared package too.
But I don't know of a package for MacOS that has these packages split up. The binary distribution for MacOS has everything.
You could install the MySQL package for MacOS and just ignore the fact that you have a mysqld instance. Or you could stop the instance and configure it not to start automatically at bootup (the MacOS distribution includes a System Preferences applet for MySQL, where you can configure it).
If you want just the client on MacOS, you'd probably have to download the source and build it yourself. I think that's more trouble than it's worth. It would require installing Xcode, and figuring out how to build the client only, etc. This work would likely take hours.
I'd just install the MacOS distribution and be done with the task.
There is another option.
A. Steps:
Should also work when you remove MysqlWorkbench.
B. Install XAMPP and replace mysqldump path in workbench https://stackoverflow.com/a/40361525/5380255
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With