当前位置: 首页 > article >正文

适合DBA的brew上手指南

##

适合DBA的brew上手指南

1、brew安装

1.1、安装方法概述

https://brew.sh/

安装方法1:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

安装方法2:

.pkg 安装器下载地址:https://github.com/Homebrew/brew

1.2、安装

#这里选择的是pkg的安装器,下一步>下一步就可以了

This package will install to:
	⁃	/opt/homebrew on Apple Silicon
	⁃	/usr/local/bin/brew and /usr/local/Homebrew on Intel

设置环境变量(Apple silicon和Intel的目录不一样)

[root@demodeMacBook-Air.local:/Users/demo]$vi .bash_profile 
export PATH=/opt/homebrew/bin:$PATH

[root@demodeMacBook-Air.local:/Users/demo]$vi .zshrc
export PATH=/opt/homebrew/bin:$PATH

[root@demodeMacBook-Air.local:/Users/demo]$exit
logout
demo@demodeMacBook-Air ~ % source ~/.bash_profile 
demo@demodeMacBook-Air ~ % source ~/.zshrc  

demo@demodeMacBook-Air ~ % brew --version
Homebrew 4.4.25
1.3、测试
demo@demodeMacBook-Air ~ % brew install wget

demo@demodeMacBook-Air ~ % wget --version
GNU Wget 1.25.0 在 darwin22.6.0 上编译。

#下载太慢只能开代理或者更换源

2、数据库基础测试

#这里使用mysql

2.1、安装
demo@demodeMacBook-Air ~ % brew install mysql@8.4
...
==> mysql@8.4
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -u root

mysql@8.4 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have mysql@8.4 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/mysql@8.4/bin:$PATH"' >> ~/.zshrc

For compilers to find mysql@8.4 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/mysql@8.4/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/mysql@8.4/include"

To start mysql@8.4 now and restart at login:
  brew services start mysql@8.4
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/mysql@8.4/bin/mysqld_safe --datadir\=/opt/homebrew/var/mysql

启动

  brew services start mysql@8.4

改密码,检查目录

demo@demodeMacBook-Air ~ % /opt/homebrew/opt/mysql@8.4/bin/mysql -uroot -p
Enter password: 

mysql> alter user root@'localhost' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
demo@demodeMacBook-Air ~ % /opt/homebrew/opt/mysql@8.4/bin/mysql -uroot -p123456

mysql> show variables like 'datadir';
+---------------+--------------------------+
| Variable_name | Value                    |
+---------------+--------------------------+
| datadir       | /opt/homebrew/var/mysql/ |
+---------------+--------------------------+
1 row in set (0.01 sec)

mysql> show variables like 'log_error';
+-------------------------------+----------------------------------------+
| Variable_name                 | Value                                  |
+-------------------------------+----------------------------------------+
| log_error                     | ./demodeMacBook-Air.local.err          |
+-------------------------------+----------------------------------------+
11 rows in set (0.00 sec)

mysql> \q
Bye

2.2、服务检查和停止
demo@demodeMacBook-Air mysql % brew services list  
Name      Status  User File
mysql@8.4 started demo ~/Library/LaunchAgents/homebrew.mxcl.mysql@8.4.plist
demo@demodeMacBook-Air mysql % brew services stop mysql@8.4
Stopping `mysql@8.4`... (might take a while)
==> Successfully stopped `mysql@8.4` (label: homebrew.mxcl.mysql@8.4)
demo@demodeMacBook-Air mysql % brew services list          
Name      Status User File
mysql@8.4 none  
2.3、卸载和删除
demo@demodeMacBook-Air ~ % brew uninstall mysql@8.4
Uninstalling /opt/homebrew/Cellar/mysql@8.4/8.4.4_3... (322 files, 303.6MB)
==> Autoremoving 7 unneeded formulae:
abseil
icu4c@77
lz4
protobuf@29
xz
zlib
zstd
Uninstalling /opt/homebrew/Cellar/protobuf@29/29.4... (445 files, 15.4MB)
Uninstalling /opt/homebrew/Cellar/zlib/1.3.1... (14 files, 403.5KB)
Uninstalling /opt/homebrew/Cellar/zstd/1.5.7... (32 files, 2.2MB)
Uninstalling /opt/homebrew/Cellar/icu4c@77/77.1... (277 files, 81.2MB)
Uninstalling /opt/homebrew/Cellar/lz4/1.10.0... (24 files, 714.2KB)
Uninstalling /opt/homebrew/Cellar/xz/5.6.4... (96 files, 2.4MB)
Uninstalling /opt/homebrew/Cellar/abseil/20240722.1... (772 files, 11.8MB)
demo@demodeMacBook-Air ~ % cd /opt/homebrew/ 
demo@demodeMacBook-Air homebrew % ls
CHANGELOG.md	Cellar		LICENSE.txt	bin		etc		manpages	sbin
CONTRIBUTING.md	Dockerfile	Library		completions	include		opt		share
Caskroom	Frameworks	README.md	docs		lib		package		var
demo@demodeMacBook-Air homebrew % cd var 
demo@demodeMacBook-Air var % ls
homebrew	mysql
demo@demodeMacBook-Air var % cd mysql
demo@demodeMacBook-Air mysql % ls
#ib_16384_0.dblwr		ca-key.pem			mysql				server-key.pem
#ib_16384_1.dblwr		ca.pem				mysql.ibd			sys
#innodb_redo			client-cert.pem			mysql_upgrade_history		undo_001
#innodb_temp			client-key.pem			performance_schema		undo_002
auto.cnf			demodeMacBook-Air.local.err	private_key.pem
binlog.000001			ib_buffer_pool			public_key.pem
binlog.index			ibdata1				server-cert.pem
demo@demodeMacBook-Air mysql % cd ..
demo@demodeMacBook-Air var % ls -lsa
total 0
0 drwxrwxr-x   4 demo  admin   128  3 24 14:58 .
0 drwxr-xr-x  33 demo  admin  1056  3 24 11:41 ..
0 drwxrwxr-x   4 demo  admin   128  3 24 14:44 homebrew
0 drwxr-xr-x  27 demo  admin   864  3 24 15:06 mysql
demo@demodeMacBook-Air var % rm -fr mysql

3、其他数据库服务

demo@demodeMacBook-Air var % brew search mariadb
==> Formulae
mariadb                   mariadb@10.10             mariadb@10.5              mariadb@11.0              mariadb@11.4
mariadb-connector-c       mariadb@10.11             mariadb@10.6              mariadb@11.1              qt-mariadb
mariadb-connector-odbc    mariadb@10.4              mariadb@10.9              mariadb@11.2

==> Casks
maria                                                             navicat-for-mariadb
demo@demodeMacBook-Air var % brew search postgresql
==> Formulae
postgresql-hll            postgresql@12             postgresql@14             postgresql@16             qt-postgresql
postgresql@11             postgresql@13             postgresql@15             postgresql@17             postgrest

==> Casks
navicat-for-postgresql                                            posture-pal

If you meant "postgresql" specifically:
postgresql breaks existing databases on upgrade without human intervention.

See a more specific version to install with:
  brew formulae | grep postgresql@
demo@demodeMacBook-Air var % brew search mongodb   
==> Formulae
mongodb-atlas-cli                           mongosh                                     monetdb

==> Casks
gcollazo-mongodb                            mongodb-compass-readonly                    mongodbpreferencepane
mongodb-compass                             mongodb-compass@beta                        mongotron
mongodb-compass-isolated-edition            mongodb-realm-studio                        nosqlbooster-for-mongodb
demo@demodeMacBook-Air var % brew search redis  
==> Formulae
hiredis         iredis          redis           redis-leveldb   redis@6.2       redir           redict          redo

==> Casks
another-redis-desktop-manager               medis                                       redis-pro
jpadilla-redis                              redis-insight
demo@demodeMacBook-Air var % brew search oracle
==> Formulae
potrace

==> Casks
color-oracle                     oracle-jdk                       oracle-jdk-javadoc@21            oracle-jdk@21
navicat-for-oracle               oracle-jdk-javadoc               oracle-jdk@17                    orange
demo@demodeMacBook-Air var % 

4、常用命令

demo@demodeMacBook-Air var % brew --help
Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  brew uninstall FORMULA|CASK...
  brew list [FORMULA|CASK...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA|CASK

Contributing:
  brew create URL [--no-fetch]
  brew edit [FORMULA|CASK...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

http://www.kler.cn/a/612071.html

相关文章:

  • (C语言)网络编程之TCP(含三次握手和四次挥手详解)
  • 适配器模式及其典型应用
  • Vue-create-vue-开发流程-项目结构-API风格-ElementPlus-入门准备工作
  • 【保姆级别教程】VMware虚拟机安装Mac OS15苹果系统附带【VMware TooLS安装】【解锁虚拟机】和【Mac OS与真机共享文件夹】手把手教程
  • 分布式共识算法解密:从Paxos到Raft的演进之路
  • 使用string和string_view(一)——C风格字符串、字符串字面量和std::string
  • 批量将 PDF 转换为 Word/PPT/Txt/Jpg图片等其它格式
  • 开发DOM更新算法
  • [python]基于yolov8实现热力图可视化支持图像视频和摄像头检测
  • CentOS 7安装 mysql
  • 老是忘记package.json,备忘一下 webpack 环境下 Vue Cli 和 Vite 命令行工具对比
  • 【Pandas】pandas Series to_xarray
  • SpringBoot集成腾讯云OCR实现身份证识别
  • 【牛客网】数据分析笔试刷题
  • Charles抓HTTPS包
  • 数据结构:汉诺塔问题的递归求解和分析
  • 部分 Bash 内置命令的详解
  • 企业网站源码HTML成品网站与网页代码模板指南
  • 学习记录-Ajax-自封装axios函数
  • RAMS(区域大气建模系统)评估土地利用/覆被变化的气候与水文效应