Mac 安装 MySQL 客户端并为 DBeaver 配置 mysqldump 导出命令

一、场景描述
  • 在项目开发过程中,经常需要连接远程环境的数据库做相应的操作

  • DBeaver 是一款非常实用(社区版免费)的数据库连接客户端工具

  • 在采用 DBeaver 进行导出数据库时,提示没有本地客户端的情况

  • 为解决这一问题,我们需要在 Mac 上安装 MySQL 客户端,仅仅如此

二、安装 MySQL Client
  1. 打开 Iterm2 终端工具并采用 brew 安装 mysql-client

    brew install mysql-client
    
  2. 安装完成以后特别提示信息如下

    mysql-client is keg-only, which means it was not symlinked into /usr/local,
    because it conflicts with mysql (which contains client libraries).
    
    If you need to have mysql-client first in your PATH run:
      echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
    
    For compilers to find mysql-client you may need to set:
      export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
      export CPPFLAGS="-I/usr/local/opt/mysql-client/include"
    
  3. 此刻 Mac 电脑就包含了 MySQL 客户端的一些基本命令,根据以上提示,为了不和 MySQL 服务器的安装位置冲突,所以不在环境变量中

     /usr/local/Cellar/mysql-client/8.0.22/bin/ pwd
    /usr/local/Cellar/mysql-client/8.0.22/bin
     /usr/local/Cellar/mysql-client/8.0.22/bin/ ll
    total 252040
    -r-xr-xr-x  1 rambo  admin  6534584  3  5 10:55 comp_err
    -r-xr-xr-x  1 rambo  admin  6569892  3  5 10:55 lz4_decompress
    -r-xr-xr-x  1 rambo  admin  6506948  3  5 10:55 my_print_defaults
    -r-xr-xr-x  1 rambo  admin  7413736  3  5 10:55 mysql
    -r-xr-xr-x  1 rambo  admin     5155  3  5 10:54 mysql_config
    -r-xr-xr-x  1 rambo  admin  6522772  3  5 10:55 mysql_config_editor
    -r-xr-xr-x  1 rambo  admin  7293332  3  5 10:55 mysql_secure_installation
    -r-xr-xr-x  1 rambo  admin  6551612  3  5 10:55 mysql_ssl_rsa_setup
    -r-xr-xr-x  1 rambo  admin  7303016  3  5 10:55 mysqladmin
    -r-xr-xr-x  1 rambo  admin  7705840  3  5 10:55 mysqlbinlog
    -r-xr-xr-x  1 rambo  admin  7315720  3  5 10:55 mysqlcheck
    -r-xr-xr-x  1 rambo  admin  7378184  3  5 10:55 mysqldump
    -r-xr-xr-x  1 rambo  admin  7305580  3  5 10:55 mysqlimport
    -r-xr-xr-x  1 rambo  admin  8025404  3  5 10:55 mysqlpump
    -r-xr-xr-x  1 rambo  admin  7298132  3  5 10:55 mysqlshow
    -r-xr-xr-x  1 rambo  admin  7321228  3  5 10:55 mysqlslap
    -r-xr-xr-x  1 rambo  admin  8263260  3  5 10:55 mysqltest
    -r-xr-xr-x  1 rambo  admin  7220608  3  5 10:55 perror
    -r-xr-xr-x  1 rambo  admin  6472532  3  5 10:55 zlib_decompress
    
  4. 验证命令是否可用

     /usr/local/Cellar/mysql-client/8.0.22/bin/ ./mysql -u root -h 192.169.7.42 -P 3306 -p
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 37736
    Server version: 8.0.20 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | exercise           |
    | information_schema |
    | mysql              |
    | performance_schema |
    +--------------------+
    4 rows in set (0.00 sec)
    
    mysql>
    
三、DBeaver 配置 MySQL Client
  1. 未配置前使用 DBwaver 导出报错信息为

    右击需要导出的数据库 -> 工具 -> Dump database

    1

  2. 打开 DBeaver 客户端工具

    右击数据库连接 -> 编辑连接 -> 选择本地客户端 -> 目录指向 MySQL Client 二进制文件夹目录

    2

  3. 导出数据库测试(根据需要选择)

    3

  4. 导出成功界面如下

    4

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值