由于MySQL的官网5.6.42版本的没有MacOS系统的安装文件,所以在终端使用命令行操作下载.下面将命令行窗口的操作以及配置过程的代码留个笔记,以供需要的小伙伴查询.
Last login: Wed Jan 2 17:02:31 on ttys000
liangyufengdeMacBook-Pro:~ liangyufeng$ brew
Example usage:
brew search [TEXT|/REGEX/]
brew info [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA
Contributing:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.sh
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ brew tap homebrew/versions
==> Installing dependencies for git: gettext, pcre2
==> Installing git dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.mojave.bot
Updating Homebrew...
####################################################### 76.6%^C
Error: Git must be installed and in your PATH!
Error: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.
liangyufengdeMacBook-Pro:~ liangyufeng$ brew info mysql
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
mysql: stable 8.0.12 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same binaries.)
Not installed
From: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl ✔
==> Requirements
Required: macOS >= 10.10 ✔
==> Options
--with-embedded
Build the embedded server
--with-local-infile
Build with local infile loading support
--with-memcached
Build with InnoDB Memcached plugin
==> Caveats
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 -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ clear
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ brew info mysql
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
mysql: stable 8.0.12 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same binaries.)
Not installed
From: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl ✔
==> Requirements
Required: macOS >= 10.10 ✔
==> Options
--with-embedded
Build the embedded server
--with-local-infile
Build with local infile loading support
--with-memcached
Build with InnoDB Memcached plugin
==> Caveats
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 -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Analytics
install: 63,161 (30d), 183,957 (90d), 888,341 (365d)
install_on_request: 57,982 (30d), 172,668 (90d), 790,136 (365d)
build_error: 0 (30d)
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
-bash: mysql: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$ brew install mysql
==> Installing dependencies for git: gettext, pcre2
==> Installing git dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.mojave.bottle.tar.gz
Updating Homebrew...
############ 17.8%^C
Error: Git must be installed and in your PATH!
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Downloading https://homebrew.bintray.com/bottles/mysql-8.0.12.mojave.bottle.tar.gz
^C
liangyufengdeMacBook-Pro:~ liangyufeng$ brew install mysql5.6
==> Installing dependencies for git: gettext, pcre2
==> Installing git dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.mojave.bottle.tar.gz
Updating Homebrew...
######################################################################## 100.0%
==> Pouring gettext-0.19.8.1.mojave.bottle.tar.gz
==> Caveats
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
==> Summary
? /usr/local/Cellar/gettext/0.19.8.1: 1,935 files, 16.9MB
==> Installing git dependency: pcre2
==> Downloading https://homebrew.bintray.com/bottles/pcre2-10.32.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre2-10.32.mojave.bottle.tar.gz
? /usr/local/Cellar/pcre2/10.32: 224 files, 5.5MB
==> Installing git
==> Downloading https://homebrew.bintray.com/bottles/git-2.19.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.19.1.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
==> Summary
? /usr/local/Cellar/git/2.19.1: 1,518 files, 40.1MB
==> Caveats
==> gettext
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
==> git
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
anycable-go dav1d gitmoji jmxterm [email protected] oxipng rke sourcedocs
aom dhall goreman kubeseal mesa pass-otp [email protected] spice-protocol
astrometry-net dnscontrol healpix kubespy minica pict [email protected] swagger-codegen@2
atomist-cli easyengine hexyl libcerf moarvm postgresql@10 shellz switch-lan-play
azure-storage-cpp eg-examples i386-elf-binutils libgusb needle qalculate-gtk ship tass64
c-blosc esptool i386-elf-gcc libnova node@10 rakudo simple-scan tealdeer
cgit fluxctl i386-elf-gdb libpulsar nqp rargs sloc termtosvg
create-dmg fx inadyn libvirt-glib nu-smv react-native-cli sng um
cryptominisat gambit-scheme interactive-rebase-tool libvmaf objfw [email protected] [email protected] up
curl-openssl ghr istioctl lsd opa resin-cli sonobuoy websocat
==> Updated Formulae
gdbm ✔ docker-machine-parallels ibex mongo-c-driver scipy
git ✔ docker-squash icdiff mongo-cxx-driver scour
libpng ✔ doctl icecream mongo-orchestration scrcpy
libtiff ✔ docutils icemon mongodb sdb
mercurial ✔ doitlive icu4c [email protected] sdcc
openssl ✔ dosbox-x idris [email protected] sdl2
portmidi ✔ dovecot ike-scan mongoose sdl2_image
sphinx-doc ✔ doxygen imagemagick mono sdl2_mixer
sqlite ✔ dpkg imagemagick@6 mosquitto sec
webp ✔ druid imageoptim-cli mozjpeg selenium-server-standalone
abcm2ps dscanner imageworsener mpc serverless
abyss dub imapfilter mpd sfcgal
ace duc immortal mpich s-libev
activemq duo_unix influxdb mplayer shairport-sync
advancecomp duplicity innotop mps-youtube shc
advancemame dvm inspircd mpv shellcheck
adwaita-icon-theme dwdiff instead mruby shellshare
agda dwm internetarchive mu shfmt
aha dynare ioping muparser shibboleth-sp
aircrack-ng e2fsprogs ios-deploy mupdf shocco
akamai eccodes ios-webkit-debug-proxy mupdf-tools shogun
alexjs ed ipfs mutt signify-osx
algernon editorconfig iproute2mac mycli sile
allure efl ipython mysql simple-amqp-client
alluxio eigen isync [email protected] sip
amazon-ecs-cli ejabberd itstool [email protected] siril
ammonite-repl elasticsearch jabba [email protected] skaffold
amqp-cpp [email protected] jansson mysqltuner skafos
angle-grinder elektra jbake n skinny
angular-cli elixir jbig2dec nailgun skopeo
anjuta emacs-clang-complete-async jboss-forge nano sleuthkit
annie embulk jdnssec-tools nanomsg smartmontools
ansible emscripten jdupes nasm smimesign
ansible-cmdb envconsul jena nativefier snapcraft
ansifilter eprover jenkins nats-streaming-server snappystream
antlr epubcheck jenkins-job-builder ncmpcpp snapraid
antlr4-cpp-runtime eralchemy jenkins-lts nco sngrep
antlr@2 erlang jetty ncview softhsm
apache-arrow erlang@17 jflex ne solr
apache-arrow-glib erlang@18 jfrog-cli-go neo4j sonar-scanner
apache-drill erlang@19 jhipster neofetch sonarqube
apache-flink erlang@20 jid neovim sops
apache-geode eslint joplin netcdf source-highlight
apache-spark etcd jq netdata source-to-image
app-engine-java ethereum jrnl netpbm sourcekitten
aptly euler-py json-fortran nettle sox
arangodb evince jsonnet newsboat spades
arcade-learning-environment exercism jsonrpc-glib nexus spdlog
ark exiv2 juju nghttp2 spotbugs
armadillo exploitdb jump nginx sqlcipher
armor eye-d3 just ngspice sqldiff
arx faas-cli kafka nifi sqlite-analyzer
asciidoc fabio kakoune nmh sqlmap
asciidoctor fabric kallisto nng sqlparse
asdf fatsort kapacitor nnn sratoolkit
aspectj fauna-shell khal node ssh-copy-id
atdtool fb-client kibana node-build sshconfigfs
aubio fbi-servefiles [email protected] node@6 sshuttle
augustus fd kitchen-sync node@8 sslmate
autopep8 fdk-aac knot nodeenv sslscan
autorest fdk-aac-encoder knot-resolver nodenv statik
aws-es-proxy feedgnuplot kobalt nsd stellar-core
aws-sdk-cpp feh kompose nss stern
awscli ffmpeg konoha numpy stgit
awslogs ffmpeg2theora kontena nuxeo stockfish
azure-cli [email protected] kops nvm stone-soup
b2-tools ffmpegthumbnailer kotlin nwchem stormpath-cli
babel ffms2 krakend nyx stormssh
babl field3d krb5 ocaml streamlink
ballerina file-formula kube-aws ocaml-num stubby
basex fio kubectx ocamlbuild stunnel
bash firebase-cli kubeless ocamlsdl subversion
bash-snippets fish kubernetes-cli ocrmypdf sundials
bat flake8 kubernetes-helm octave supervisor
bazel flann kubernetes-service-catalog-client odpi suricata
bcal fltk kustomize ompl svtplay-dl
bde fluent-bit lablgtk oniguruma swagger-codegen
bdw-gc fluid-synth landscaper opam swi-prolog
beagle flume languagetool open-mpi swift
beast flyway lasso open-scene-graph swift-protobuf
bento4 fmpp lastpass-cli openapi-generator swiftformat
bettercap fmt laszip openblas swiftlint
bgpdump fn latex2html opencascade swimat
bgpq3 fobis latexdiff opencoarrays sync_gateway
bigloo folly lcm openconnect syncthing
binaryen fonttools ldc opencv sysbench
bind ford lean-cli opencv@2 sysdig
binutils fork-cleaner ledger openforti tarantool
binwalk fping legit openimageio tarsnapper
bison fq lego openldap taskell
bitcoin freeciv leiningen openmsx tbb
bitrise freeling leptonica openrct2 tcc
bitwarden-cli freetds less openrtsp tcpdump
blackbox [email protected] lgogdownloader openshift-cli tcpreplay
blast frugal libassuan openssh tectonic
blink1 fruit libatomic_ops [email protected] telegraf
bluepill fselect libav opentsdb teleport
blueutil fswatch libbi openvdb temporal_tables
bmake fuseki libbitcoin opus tepl
bnd futhark libbitcoin-blockchain opus-tools termius
boost fwup libbitcoin-client opusfile termrec
boost-bcp gammaray libbitcoin-database orc-tools terraform
boost-build gandi.cli libbitcoin-explorer osm2pgrouting terraform-docs
boost-mpi gauche libbitcoin-network osmium-tool terraform_landscape
boost-python gauge libbitcoin-node osquery terragrunt
boost-python3 gcab libbitcoin-protocol osrm-backend tesseract
botan gcc@6 libbitcoin-server oysttyer testssl
bowtie2 gcc@7 libbladerf pacapt tgui
braid gdal libbtbb packer thefuck
brew-php-switcher gdb libccd pagmo theharvester
brogue gdcm libcdr paket thors-serializer
brotli gecode libcds pandoc tika
btfs gedit libcec pandoc-citeproc tile38
buildifier geeqie libcouchbase pandoc-crossref tinc
buku gegl libdazzle pangomm tinyproxy
bullet genometools libdill parallel tinyxml2
bundletool geos libedit parallelstl tippecanoe
bup get_iplayer liberasurecode passenger tmux
byteman getdns libetpan passpie tmuxinator-completion
bzt gexiv2 libextractor payara tomcat
c-ares gflags libfabric pazpar2 tomcat-native
c10t ghc libfreehand pcl tomcat@7
cabal-install ghostscript libgcrypt pdal tomcat@8
cabextract gimme libgda pdfpc tomee-webprofile
caddy git-annex libgit2 pdftoedn topgrade
caf git-archive-all libgit2-glib pdftoipe tor
caffe git-cinnabar libgosu percol tox
cairo git-lfs libgpg-error percona-server traefik
cake git-open libgphoto2 [email protected] translate-shell
calc git-quick-stats libgsf percona-toolkit translate-toolkit
camlp5 git-recent libgxps perl trash-cli
capstone git-review libhttpserver petsc travis
cargo-completion git-standup libical petsc-complex tree
carla git-subrepo libidn2 pgbadger treefrog
carthage gitbucket libimagequant pgcli tty-solitaire
cassandra gitfs libjson-rpc-cpp pgformatter ttyd
catimg gitg libjwt pgroonga tundra
cayley github-markdown-toc liblcf pgrouting tunnel
ccache gitlab-gem liblo pgweb tup
ccextractor gitlab-runner libmagic phoronix-test-suite tvnamer
cclive gitless libmatio php twarc
ccm gitversion libmicrohttpd php-code-sniffer twine-pypi
ceres-solver gjs libmspub php-cs-fixer twoping
cern-ndiff glances libmxml [email protected] typescript
certbot glib libnice phpmyadmin ubertooth
certigo glibmm libomp phpunit ucloud
cfitsio glm libopendkim picard-tools uhd
cglm global libopusenc picat unbound
chakra globjects libosmium pig uncrustify
chamber glslang libphonenumber pijul unnethack
cheat gmic libplctag pike unoconv
checkbashisms gmime libplist pilosa unshield
checkstyle gmsh libpq pip-completion upscaledb
chicken gmt libpqxx pipenv urdfdom_headers
chisel gmt@4 libproxy pius urh
choose gnome-latex libpsl pixman uriparser
chrome-export gnu-sed libpst pktanon uru
chronograf gnu-tar libqalculate planck urweb
chruby-fish gnu-units librdkafka plantuml v8
circleci gnupg librealsense platformio vagrant-completion
citus gnuplot libressl plplot vala
ckan gnuradio librsvg pmd valgrind
clamav gnutls libsamplerate pngquant vapoursynth
clang-format go libsass podofo varnish
clblast go-bindata libsecret ponyc vault
cli53 go-statik libsigc++ poppler vaulted
cling [email protected] libsodium posh vegeta
clojure goaccess libsoup postgis verilator
clojurescript gobject-introspection libspectre postgresql vert.x
closure-compiler gocryptfs libssh ppsspp vfuse
cmake godep libstfl pqiv vice
cmark-gfm goenv libswiften pre-commit vim
cmdshelf goffice libtcod presto [email protected]
cnats golang-migrate libtensorflow prettier vips
cockroach googler libtins primesieve visp
cocoapods goolabs libtorrent-rasterbar prips vnu
codemod gopass libuv prometheus voldemort
cointop goreleaser libvirt proselint vsts-cli
collectd gosu libvisio protobuf vte3
collector-sidecar gowsdl libvoikko ps2eps vtk
commandbox gpa libwebsockets pspg wabt
composer gpgme libxlsxwriter pulumi wakatime-cli
conan gphoto2 libxml2 pumba wallpaper
configen gprof2dot libxmlsec1 purescript wartremover
confluent-oss gpsbabel libxslt pushpin watchman
console_bridge gr-osmosdr lighttpd pwntools watson
consul gradio linkerd py2cairo wcslib
container-diff gradle livestreamer py3cairo weaver
convox grafana llvm pyenv weboob
cookiecutter grails [email protected] pygitup webpack
coq grakn llvm@4 pygobject3 weechat
couchdb graph-tool llvm@5 pyinvoke wesnoth
cp2k graphicsmagick llvm@6 python wget
cpanminus graphite2 lmdb python-markdown when
cppcheck grep lmod q whois
cpprestsdk grib-api logstash qbs widelands
crc32c grip logtalk qcli wine
credstash groff lolcat qemu winetricks
cromwell groovy lsdvd qmmp wireguard-go
crosstool-ng groovysdk lumo qpdf wireguard-tools
crowdin grpc luvit qpid-proton wireshark
cryptopp grunt-cli lxc qt woboq_codebrowser
crystal grunt-completion lynis quicktype wolfssl
crystal-icr grv mackup r wp-cli
cucumber-cpp gst-plugins-good macvim rabbitmq wp-cli-completion
curaengine gst-plugins-ugly magic-wormhole radare2 wpscan
curl gst-python makensis rakudo-star wskdeploy
cvs2svn gstreamermm mame rancher-cli wtf
cython gtk+3 mandoc range-v3 wxmaxima
dartsim gtk-doc mapnik rbspy x264
dash gtkmm3 mapserver rclone xcodegen
dasht gtkspell3 mariadb rdesktop xctool
dateutils gucharmap mariadb-connector-c re2 xmake
davix gupnp-av [email protected] rebar3 xml-security-c
dbhash gupnp-tools [email protected] recon-ng xml-tooling-c
dbus gwyddion [email protected] recutils xmrig
dcd gzip mas redis xonsh
dcm2niix hadolint math-comp redo xsimd
ddgr handbrake maven remarshal xtensor
dependency-check hapi-fhir-cli maxwell repo yaml-cpp
dfmt haproxy mdcat restic yamllint
dhall-json harfbuzz mdp restview yank
dialog hashpump mdv riemann-client yara
diamond haskell-stack media-info rmlint yarn
diceware haste-client megacmd robot-framework yasm
diff-pdf hbase memcached rom-tools yaz
diffoscope hcloud meson root ydcv
diffutils hdf5 metaproxy roswell ykman
digdag [email protected] micronaut rpm yle-dl
digitemp hebcal midnight-commander rst-lint yosys
direnv helmfile mikutter rswift you-get
dita-ot help2man mill rtags youtube-dl
django-completion hfstospell miller ruby yq
dlib highlight mimic ruby-build z3
dmd hiredis minio [email protected] zanata-client
dnscrypt-proxy hive minio-mc rust zebra
dnscrypt-wrapper hmmer miniserve rustup-init zeromq
dnsmasq homebank minizinc s-search zile
dnstwist honcho mint s3cmd zim
docfx howdoi mitie safe zimg
docker http-parser mkcert sagittarius-scheme znc
docker-completion httpd mkclean salt zookeeper
docker-compose httpie mkdocs sbcl zorba
docker-compose-completion hub mkl-dnn sbt zsh
docker-credential-helper-ecr hugo mkvtoolnix [email protected] zsh-autosuggestions
docker-ls hunspell mlt scala zsh-completions
docker-machine hwloc mmseqs2 scalaenv zstd
docker-machine-completion hydra mockserver scalapack zurl
docker-machine-driver-xhyve hyperfine monero sceptre
docker-machine-nfs i2pd monetdb schismtracker
==> Renamed Formulae
gtksourceview@4 -> gtksourceview4 gutenberg -> zola hh -> hstr mat -> mat2 php72 -> [email protected]
==> Deleted Formulae
apple-gcc42 corebird gnome-doc-utils heroku ld64 mimms open-vcdiff pldebugger reclass sickbeard
aptly-completion datomic [email protected] ib lsh nesemu2 opensyobon pxz rock taylor
cctools ffmbc gv juju-quickstart [email protected] nethack4 [email protected] pyexiv2 [email protected] tcptrack
cctools-headers gjstest hachoir-metadata [email protected] [email protected] onepass [email protected] queequeg sary
Error: HOMEBREW_LOGS was not exported!
Please don't worry, you likely hit a bug auto-updating from an old version.
Rerun your command, everything is up-to-date and fine now.
liangyufengdeMacBook-Pro:~ liangyufeng$ which mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
-bash: mysql: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ cd /usr/local/Cellar/
freetype/ gettext/ jpeg/ libogg/ libtiff/ mercurial/ pcre2/ portmidi/ readline/ sdl_image/ sdl_ttf/ sqlite/
gdbm/ git/ libmikmod/ libpng/ libvorbis/ openssl/ pkg-config/ python@2/ sdl/ sdl_mixer/ sphinx-doc/ webp/
liangyufengdeMacBook-Pro:~ liangyufeng$ cd /usr/local/Cellar/
liangyufengdeMacBook-Pro:Cellar liangyufeng$ ll
-bash: ll: command not found
liangyufengdeMacBook-Pro:Cellar liangyufeng$ ls
freetype gettext jpeg libogg libtiff mercurial pcre2 portmidi readline sdl_image sdl_ttf sqlite
gdbm git libmikmod libpng libvorbis openssl pkg-config python@2 sdl sdl_mixer sphinx-doc webp
liangyufengdeMacBook-Pro:Cellar liangyufeng$ ls -lrt
total 0
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:13 gdbm
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:13 openssl
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:14 readline
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:14 sqlite
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:21 pkg-config
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:21 sphinx-doc
drwxr-xr-x 3 liangyufeng admin 96 10 9 00:22 python@2
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 mercurial
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 sdl
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 jpeg
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 libpng
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 libtiff
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 webp
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:28 sdl_image
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:29 freetype
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:29 sdl_ttf
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:32 libmikmod
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:32 libogg
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:32 libvorbis
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:32 sdl_mixer
drwxr-xr-x 3 liangyufeng staff 96 10 9 00:32 portmidi
drwxr-xr-x 3 liangyufeng staff 96 1 11 20:06 gettext
drwxr-xr-x 3 liangyufeng staff 96 1 11 20:06 pcre2
drwxr-xr-x 3 liangyufeng staff 96 1 11 20:08 git
liangyufengdeMacBook-Pro:Cellar liangyufeng$ brew install [email protected]
Error: No available formula with the name "[email protected]"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
liangyufengdeMacBook-Pro:Cellar liangyufeng$ brew install [email protected]
==> Installing dependencies for [email protected]: openssl
==> Installing [email protected] dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2q.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2q.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
==> Summary
? /usr/local/Cellar/openssl/1.0.2q: 1,794 files, 12.1MB
==> Installing [email protected]
==> Downloading https://homebrew.bintray.com/bottles/[email protected]
######################################################################## 100.0%
==> Pouring [email protected]
==> /usr/local/Cellar/[email protected]/5.6.42/bin/mysql_install_db --verbose --user=liangyufeng --basedir=/usr/local/Cellar/[email protected]/5.6.42 --datadir=/usr/local/var/mysql --tmpdir=/tmp
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
MySQL is configured to only allow connections from localhost by default
To connect:
mysql -uroot
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
/usr/local/opt/[email protected]/bin/mysql.server start
==> Summary
? /usr/local/Cellar/[email protected]/5.6.42: 342 files, 154.2MB
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
==> [email protected]
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
MySQL is configured to only allow connections from localhost by default
To connect:
mysql -uroot
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
/usr/local/opt/[email protected]/bin/mysql.server start
liangyufengdeMacBook-Pro:Cellar liangyufeng$ mysql -uroot
-bash: mysql: command not found
liangyufengdeMacBook-Pro:Cellar liangyufeng$ /usr/local/Cellar/m
mercurial/ [email protected]/
liangyufengdeMacBook-Pro:Cellar liangyufeng$ /usr/local/Cellar/m
mercurial/ [email protected]/
liangyufengdeMacBook-Pro:Cellar liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/
.bottle/ .brew/ bin/ include/ lib/ libexec/ scripts/ share/ sql-bench/ support-files/
liangyufengdeMacBook-Pro:Cellar liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/bin/msql2mysql
freetype/ gettext/ jpeg/ libogg/ libtiff/ mercurial/ openssl/ pkg-config/ python@2/ sdl/ sdl_mixer/ sphinx-doc/ webp/
gdbm/ git/ libmikmod/ libpng/ libvorbis/ [email protected]/ pcre2/ portmidi/ readline/ sdl_image/ sdl_ttf/ sqlite/
liangyufengdeMacBook-Pro:Cellar liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/bin/msql2mysql
Warning: /usr/local/Cellar/[email protected]/5.6.42/bin/msql2mysql is deprecated and will be removed in a future version.
^C
liangyufengdeMacBook-Pro:Cellar liangyufeng$ cd /usr/local/Cellar/mysql\@5.6/5.6.42/bin/
liangyufengdeMacBook-Pro:bin liangyufeng$ ls
innochecksum mysql.server mysql_fix_extensions mysql_zap mysqldump perror
msql2mysql mysql_client_test mysql_install_db mysqladmin mysqldumpslow replace
my_print_defaults mysql_client_test_embedded mysql_plugin mysqlbinlog mysqlhotcopy resolve_stack_dump
myisam_ftdump mysql_config mysql_secure_installation mysqlbug mysqlimport resolveip
myisamchk mysql_config_editor mysql_setpermission mysqlcheck mysqlshow
myisamlog mysql_convert_table_format mysql_tzinfo_to_sql mysqld mysqlslap
myisampack mysql_embedded mysql_upgrade mysqld_multi mysqltest
mysql mysql_find_rows mysql_waitpid mysqld_safe mysqltest_embedded
liangyufengdeMacBook-Pro:bin liangyufeng$ ls -lrt
total 253368
-r-xr-xr-x 1 liangyufeng staff 3157072 9 10 18:23 replace
-r-xr-xr-x 1 liangyufeng staff 34938 9 10 18:23 mysqlhotcopy
-r-xr-xr-x 1 liangyufeng staff 7424 9 10 18:23 mysqldumpslow
-r-xr-xr-x 1 liangyufeng staff 3942 9 10 18:23 mysql_zap
-r-xr-xr-x 1 liangyufeng staff 17550 9 10 18:23 mysql_setpermission
-r-xr-xr-x 1 liangyufeng staff 10106 9 10 18:23 mysql_secure_installation
lrwxr-xr-x 1 liangyufeng staff 27 9 10 18:23 mysql_install_db -> ../scripts/mysql_install_db
-r-xr-xr-x 1 liangyufeng staff 1331 9 10 18:23 mysql_fix_extensions
-r-xr-xr-x 1 liangyufeng staff 3374 9 10 18:23 mysql_find_rows
-r-xr-xr-x 1 liangyufeng staff 4299 9 10 18:23 mysql_convert_table_format
lrwxr-xr-x 1 liangyufeng staff 29 9 10 18:23 mysql.server -> ../support-files/mysql.server
-r-xr-xr-x 1 liangyufeng staff 3402280 9 10 18:23 myisamlog
-r-xr-xr-x 1 liangyufeng staff 3185296 1 11 20:21 innochecksum
-r-xr-xr-x 1 liangyufeng staff 3180344 1 11 20:21 my_print_defaults
-r-xr-xr-x 1 liangyufeng staff 3425124 1 11 20:21 myisam_ftdump
-r-xr-xr-x 1 liangyufeng staff 3519928 1 11 20:21 myisamchk
-r-xr-xr-x 1 liangyufeng staff 3443204 1 11 20:21 myisampack
-r-xr-xr-x 1 liangyufeng staff 3470344 1 11 20:21 mysql
-r-xr-xr-x 1 liangyufeng staff 3761480 1 11 20:21 mysql_client_test
-r-xr-xr-x 1 liangyufeng staff 11384760 1 11 20:21 mysql_client_test_embedded
-r-xr-xr-x 1 liangyufeng staff 3374832 1 11 20:21 mysql_config_editor
-r-xr-xr-x 1 liangyufeng staff 11080428 1 11 20:21 mysql_embedded
-r-xr-xr-x 1 liangyufeng staff 3189504 1 11 20:21 mysql_plugin
-r-xr-xr-x 1 liangyufeng staff 3147136 1 11 20:21 mysql_tzinfo_to_sql
-r-xr-xr-x 1 liangyufeng staff 3484512 1 11 20:21 mysql_upgrade
-r-xr-xr-x 1 liangyufeng staff 3180128 1 11 20:21 mysql_waitpid
-r-xr-xr-x 1 liangyufeng staff 3378320 1 11 20:21 mysqladmin
-r-xr-xr-x 1 liangyufeng staff 3547660 1 11 20:21 mysqlbinlog
-r-xr-xr-x 1 liangyufeng staff 3373696 1 11 20:21 mysqlcheck
-r-xr-xr-x 1 liangyufeng staff 11766608 1 11 20:21 mysqld
-r-xr-xr-x 1 liangyufeng staff 3435992 1 11 20:21 mysqldump
-r-xr-xr-x 1 liangyufeng staff 3370296 1 11 20:21 mysqlimport
-r-xr-xr-x 1 liangyufeng staff 3368808 1 11 20:21 mysqlshow
-r-xr-xr-x 1 liangyufeng staff 3385220 1 11 20:21 mysqlslap
-r-xr-xr-x 1 liangyufeng staff 3618408 1 11 20:21 mysqltest
-r-xr-xr-x 1 liangyufeng staff 11203720 1 11 20:21 mysqltest_embedded
-r-xr-xr-x 1 liangyufeng staff 3284632 1 11 20:21 perror
-r-xr-xr-x 1 liangyufeng staff 3187036 1 11 20:21 resolve_stack_dump
-r-xr-xr-x 1 liangyufeng staff 3180348 1 11 20:21 resolveip
-r-xr-xr-x 1 liangyufeng staff 1569 1 11 20:21 msql2mysql
-r-xr-xr-x 1 liangyufeng staff 6556 1 11 20:21 mysql_config
-r-xr-xr-x 1 liangyufeng staff 10928 1 11 20:21 mysqlbug
-r-xr-xr-x 1 liangyufeng staff 27015 1 11 20:21 mysqld_multi
-r-xr-xr-x 1 liangyufeng staff 27430 1 11 20:21 mysqld_safe
liangyufengdeMacBook-Pro:bin liangyufeng$ mysqld
-bash: mysqld: command not found
liangyufengdeMacBook-Pro:bin liangyufeng$ ./mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
liangyufengdeMacBook-Pro:bin liangyufeng$ ./mysqld
2019-01-11 20:23:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-01-11 20:23:15 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-01-11 20:23:15 0 [Note] ./mysqld (mysqld 5.6.42) starting as process 62433 ...
2019-01-11 20:23:15 62433 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-11 20:23:15 62433 [Note] Plugin 'FEDERATED' is disabled.
2019-01-11 20:23:15 62433 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-01-11 20:23:15 62433 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-11 20:23:15 62433 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-11 20:23:15 62433 [Note] InnoDB: Memory barrier is not used
2019-01-11 20:23:15 62433 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-01-11 20:23:15 62433 [Note] InnoDB: Using CPU crc32 instructions
2019-01-11 20:23:15 62433 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-01-11 20:23:15 62433 [Note] InnoDB: Completed initialization of buffer pool
2019-01-11 20:23:15 62433 [Note] InnoDB: Highest supported file format is Barracuda.
2019-01-11 20:23:15 62433 [Note] InnoDB: 128 rollback segment(s) are active.
2019-01-11 20:23:15 62433 [Note] InnoDB: Waiting for purge to start
2019-01-11 20:23:15 62433 [Note] InnoDB: 5.6.42 started; log sequence number 1625987
2019-01-11 20:23:15 62433 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ab6bd996-159b-11e9-afc2-98bff386c64c.
2019-01-11 20:23:15 62433 [Note] RSA private key file not found: /usr/local/var/mysql//private_key.pem. Some authentication plugins will not work.
2019-01-11 20:23:15 62433 [Note] RSA public key file not found: /usr/local/var/mysql//public_key.pem. Some authentication plugins will not work.
2019-01-11 20:23:15 62433 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-01-11 20:23:15 62433 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2019-01-11 20:23:15 62433 [Note] Server socket created on IP: '127.0.0.1'.
2019-01-11 20:23:15 62433 [Note] Event Scheduler: Loaded 0 events
2019-01-11 20:23:15 62433 [Note] ./mysqld: ready for connections.
Version: '5.6.42' socket: '/tmp/mysql.sock' port: 3306 Homebrew
^C
^C^C^C
^C^C^C^C^C
^C^C^C^CKilled: 9
liangyufengdeMacBook-Pro:bin liangyufeng$
liangyufengdeMacBook-Pro:bin liangyufeng$
liangyufengdeMacBook-Pro:bin liangyufeng$
liangyufengdeMacBook-Pro:bin liangyufeng$ which mysqld
liangyufengdeMacBook-Pro:bin liangyufeng$ source ~/.bash_profile
liangyufengdeMacBook-Pro:bin liangyufeng$ which mysqld
/usr/local/opt/[email protected]/bin/mysqld
liangyufengdeMacBook-Pro:bin liangyufeng$ cd
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ ll
-bash: ll: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$ ls
Applications Downloads Movies Public Virtual Machines.localized iCloud Drive(归档)
Desktop Kingsoft Music PycharmProjects VirtualBox VMs test
Documents Library Pictures VMware day33上课便签.txt venv
liangyufengdeMacBook-Pro:~ liangyufeng$ nohup mysqld &
[1] 62603
liangyufengdeMacBook-Pro:~ liangyufeng$ appending output to nohup.out
liangyufengdeMacBook-Pro:~ liangyufeng$ ps -ef|grep mysqld
501 62603 25300 0 9:16下午 ttys000 0:00.47 mysqld
501 62605 25300 0 9:17下午 ttys000 0:00.00 grep mysqld
liangyufengdeMacBook-Pro:~ liangyufeng$ ps -ef|grep mysqld
501 62603 25300 0 9:16下午 ttys000 0:00.47 mysqld
501 62608 25300 0 9:17下午 ttys000 0:00.00 grep mysqld
501 62606 62055 0 9:17下午 ttys001 0:00.40 mysqld
liangyufengdeMacBook-Pro:~ liangyufeng$ kill -9 62606
liangyufengdeMacBook-Pro:~ liangyufeng$
之后打开的一个终端窗口:
Last login: Fri Jan 11 20:11:14 on ttys001
liangyufengdeMacBook-Pro:~ liangyufeng$ brew info mysql
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
mysql: stable 8.0.13 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same binaries.)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl ✔
==> Requirements
Required: macOS >= 10.10 ✔
==> Caveats
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 -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Analytics
install: 63,161 (30 days), 183,957 (90 days), 888,341 (365 days)
install_on_request: 57,982 (30 days), 172,668 (90 days), 790,136 (365 days)
build_error: 0 (30 days)
liangyufengdeMacBook-Pro:~ liangyufeng$ brew search mysql
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Formulae
automysqlbackup mysql++ mysql-cluster mysql-connector-c++ mysql-search-replace [email protected] [email protected]
mysql mysql-client mysql-connector-c mysql-sandbox mysql-utilities [email protected] mysqltuner
==> Casks
homebrew/cask/mysql-connector-python homebrew/cask/mysql-shell homebrew/cask/mysql-utilities homebrew/cask/navicat-for-mysql homebrew/cask/sqlpro-for-mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ /usr/local/Cellar/
freetype/ gettext/ jpeg/ libogg/ libtiff/ mercurial/ openssl/ pkg-config/ python@2/ sdl/ sdl_mixer/ sphinx-doc/ webp/
gdbm/ git/ libmikmod/ libpng/ libvorbis/ [email protected]/ pcre2/ portmidi/ readline/ sdl_image/ sdl_ttf/ sqlite/
liangyufengdeMacBook-Pro:~ liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.42 Homebrew
Copyright (c) 2000, 2018, 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>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> exit
Bye
liangyufengdeMacBook-Pro:~ liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.42 Homebrew
Copyright (c) 2000, 2018, 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> exit
Bye
liangyufengdeMacBook-Pro:~ liangyufeng$ /usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.42 Homebrew
Copyright (c) 2000, 2018, 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> exit
Bye
liangyufengdeMacBook-Pro:~ liangyufeng$ echo "/usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql" >> ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ cat ~/.bash_profile
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
/usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ vi ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ source ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
-bash: mysql: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$ vi ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ cat ~/.
./ .CFUserTextEncoding .Trash/ .bash_profile .config/ .idlerc/ .mysql_history .sogouinput/ .viminfo
../ .DS_Store .bash_history .bash_sessions/ .gitconfig .kingsoft/ .python_history .ssh/ .vscode/
liangyufengdeMacBook-Pro:~ liangyufeng$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ pwd
/Users/liangyufeng
liangyufengdeMacBook-Pro:~ liangyufeng$ echo 'export PATH="/usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql:$PATH"' >> ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ source ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
-bash: mysql: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ cat ~/.bash_profile
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}":/usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql
export PATH
export PATH="/usr/local/Cellar/mysql\@5.6/5.6.42/bin/mysql:$PATH"
liangyufengdeMacBook-Pro:~ liangyufeng$ which mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ vim ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ source ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
-bash: mysql: command not found
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ vi ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ source ~/.bash_profile
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.42 Homebrew
Copyright (c) 2000, 2018, 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> exit
Bye
liangyufengdeMacBook-Pro:~ liangyufeng$ ps -ef|grep mysql
501 62433 25300 0 8:23下午 ttys000 0:00.92 ./mysqld
501 62593 62055 0 9:14下午 ttys001 0:00.00 grep mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ kill -9 62433
liangyufengdeMacBook-Pro:~ liangyufeng$ which mysql
/usr/local/opt/[email protected]/bin/mysql
liangyufengdeMacBook-Pro:~ liangyufeng$ mysqld
2019-01-11 21:17:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-01-11 21:17:22 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-01-11 21:17:22 0 [Note] mysqld (mysqld 5.6.42) starting as process 62606 ...
2019-01-11 21:17:22 62606 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-11 21:17:22 62606 [Note] Plugin 'FEDERATED' is disabled.
2019-01-11 21:17:22 62606 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-01-11 21:17:22 62606 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-11 21:17:22 62606 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-11 21:17:22 62606 [Note] InnoDB: Memory barrier is not used
2019-01-11 21:17:22 62606 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-01-11 21:17:22 62606 [Note] InnoDB: Using CPU crc32 instructions
2019-01-11 21:17:22 62606 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-01-11 21:17:22 62606 [Note] InnoDB: Completed initialization of buffer pool
2019-01-11 21:17:22 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:22 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:22 62606 [Note] InnoDB: Retrying to lock the first data file
^C2019-01-11 21:17:23 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:23 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
^C^C^C2019-01-11 21:17:24 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:24 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:25 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:25 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
^C^C2019-01-11 21:17:26 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:26 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
^C2019-01-11 21:17:27 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:27 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:28 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:28 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:29 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:29 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:30 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:30 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:31 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:31 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:32 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:32 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:33 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:33 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:34 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:34 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:35 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:35 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:36 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:36 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:37 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:37 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:38 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:38 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:39 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:39 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:40 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:40 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:41 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:41 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-01-11 21:17:42 62606 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2019-01-11 21:17:42 62606 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
Killed: 9
liangyufengdeMacBook-Pro:~ liangyufeng$
liangyufengdeMacBook-Pro:~ liangyufeng$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.42 Homebrew
Copyright (c) 2000, 2018, 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 |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> exit
Bye
liangyufengdeMacBook-Pro:~ liangyufeng$
使用下面的命令行操作来打开数据库:(如果电脑不关机就没必要输入这句话了,只需要每次电脑关机重启的时候才需要输入一次.MySQL用完也没必要关闭.) nohup mysqld &
liangyufengdeMacBook-Pro:~ liangyufeng$ nohup mysqld &