赞
踩
方法:直接用Homebrew安装
brew install mysql
zhangjingyideMacBook-Pro:~ zhangjingyi$ brew install mysql Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae anime-downloader k3d antibody k6 appstream-glib kim-api atlantis libevhtp catch2 libzt cjson lizard clojure-lsp mariadb@10.3 clzip molten-vk contentful-cli netlify-cli csvq newman cxxopts openkim-models cypher-shell pipx dbmate pprint deno procs devspace proteinortho docker-machine-driver-vmware scala@2.12 drone-cli scdoc dust scws erlang@21 spice-gtk gatsby-cli spirv-tools gcc@8 swig@3 heatshrink termshark helmsman terraform@0.11 hey terraformer include-what-you-use virgil ipopt yapf janet ==> Updated Formulae erlang ✔ libnfs gettext ✔ libnice git ✔ libnids openssl ✔ libnotify rabbitmq ✔ libntlm abyss libodfgen ack libofx acpica libomp agda libopenmpt aide libosinfo akamai libpeas akka libphonenumber aliyun-cli libpq allure libpqxx allureofthestars libprotoident alot libpsl amazon-ecs-cli libpst ammonite-repl libpulsar amqp-cpp libqalculate amtk libquicktime angle-grinder librasterlite angular-cli librdkafka anjuta libre annie librealsense ansible librem ant libressl ant@1.9 librest anyenv librsvg apache-archiva libsass apache-arrow-glib libsecret apache-drill libshout apache-spark libsigc++ app-engine-python libsmf apt-dater libsodium aqbanking libsoup arangodb libspectre aravis libspectrum argon2 libssh2 argyll-cms libsvm armadillo libswiften arpack libtorrent-rasterbar artifactory libtrace asciidoctor libuninameslist asciidoctorj libuv asdf libvirt ask-cli libvirt-glib aspectj libwpd astrometry-net libwpg atari800 libxc atk libxlsxwriter atkmm libxml++ atlassian-cli libxml++3 atomist-cli libxo audacious libzdb auditbeat lighttpd augeas lilv autorest linkerd avra lldpd avro-c llvm avro-cpp lmod avro-tools logstash awf logtalk aws-okta loudmouth aws-sdk-cpp lsd awscli luarocks axel lv2 azure-cli lwtools azure-storage-cpp lxc b2-tools lynis babel lysp babl lzip badtouch mackup balena-cli macvim ballerina mafft baobab magic-wormhole bartycrouch mailutils basex mame bat mariadb bazel mariadb-connector-c beanstalkd mariadb@10.1 bear mariadb@10.2 bedops mat2 bee math-comp bettercap maxima bgpstream maxwell binaryen mbedtls bind mcabber binwalk mdbook bison mdbtools bit mdds bitcoin mdk bitlbee mednafen bitrise megatools bitwarden-cli memcached blink1 mercurial bluepill mesa bookloupe meson boost mesos boost-bcp metaproxy boost-build metricbeat boost-mpi mgba boost-python micronaut boost-python3 micropython bowtie2 midgard2 braid midnight-commander buildifier mighttpd2 buildkit mikutter buku mill bundletool minbif bwfmetaedit minimal-racket byobu minio byteman minio-mc bzip2 minizinc bzt mk-configure cadaver mkl-dnn caffe mksh cairo mkvtoolnix calcurse mlkit calicoctl mlt camlp4 mmark cargo-completion mmseqs2 cataclysm molecule catimg monero cattle monetdb cc65 mongo-c-driver ccache mongoose ccextractor mono-libgdiplus ccls mosquitto center-im mp3splt certbot mpck cf4ocl mpd cfengine mpdscribble cfn-lint mpich cfr-decompiler mplayer cgal mpop cgit mruby cglm msgpack cgrep msitools chafa msktutil chakra msmtp chamber mtools charm mu checkbashisms mujs checkstyle mupdf chicken mupdf-tools chrome-export mutt chronograf mvnvm circleci mysql citus mysql@5.7 clang-format mysqltuner cloc n clojure nano clozure-cl nanopb-generator clutter nativefier clutter-gst nats-streaming-server clutter-gtk nave cmake ncdc cmark-gfm ncmpc cmocka ncmpcpp cockroach nco cocoapods ndpi cogl needle cointop neo4j collectd neomutt commandbox neovim composer netcdf conan netdata conserver nethack consul netpbm convox newsboat coq newt corectl nexus corsixth nghttp2 cp2k nginx cpansearch nifi-registry cppad nim cppcheck nlopt cpprestsdk nnn cql node cracklib node-build crc32c node@10 cromwell node_exporter crosstool-ng nodenv crowdin nomad cryfs nordugrid-arc cryptol noti crystal notmuch csound nss cucumber-cpp ntfs-3g curl ntl curl-openssl numpy curlftpfs nwchem cutter nzbget cython ocaml-num dartsim ocrmypdf datetime-fortran octave dav1d odpi davix ola dbus-glib ompl dc3dd oniguruma dcd opa dcm2niix open-mpi dehydrated openapi-generator dep openblas dependency-check opencascade desktop-file-utils opencc dfc opencoarrays dfmt openconnect dhall opencv dhall-json opencv@3 diff-pdf openfortivpn diff-so-fancy openh264 diffoscope openimageio digdag openshift-cli dita-ot openslide django-completion openssl@1.1 dmd opensubdiv dnscontrol openvdb dnscrypt-proxy operator-sdk dnstwist orbit docfx orc-tools docker osc docker-completion oscats docker-compose osm-gps-map docker-compose-completion osm2pgrouting docker-credential-helper osmosis docker-machine-driver-xhyve ospray doctl osquery dopewars osrm-backend double-conversion owfs dovecot oxipng druid p11-kit dscanner packer dspdfviewer packmol dub paket duc pam-u2f duck pandoc dungeon pandoc-crossref duo_unix pango dwdiff pangomm dynare paperkey e2fsprogs paps easy-tag parallel easyengine parallelstl eccodes pari efl passenger eiffelstudio patchelf elasticsearch payara elasticsearch@5.6 pcapplusplus elixir pcb embree pcb2gcode emscripten pdal encfs pdf2htmlex enchant pdf2svg enigma pdfpc enscript pdftoipe envconsul pdns epubcheck pdnsrec erlang@19 peg-markdown erlang@20 percona-xtrabackup eslint perl etcd peru etl petsc ettercap petsc-complex evince pgbadger exiftool pgcli exiv2 pgformatter expat pgplot exploitdb pgrouting eye-d3 phoronix-test-suite f3 php faas-cli php-cs-fixer fastme php@7.1 faudio php@7.2 fceux phpmyadmin ffmpeg phpstan ffsend phpunit fftw physfs fibjs picard-tools file-formula picat fio pick firebase-cli pidgin flatbuffers pilosa flex pinboard-notes-backup flintrock pinfo flow pioneers fluid-synth planck fluxctl plantuml fn plplot fobis plzip folly pmd fontforge pms fonttools pngquant fourstore pod2man fq podofo freeciv ponyc freedink poppler freeradius-server postgresql freetds postgresql@10 freetype postgresql@9.4 frpc postgresql@9.5 frps postgresql@9.6 frugal postgrest fs-uae pqiv fselect pre-commit fuse-emulator prefixsuffix fuseki presto futhark prettier gabedit profanity gammu proguard gandi.cli proj gauge prometheus gawk protobuf-c gbdfed protoc-gen-go gcab prototool gcc pstoedit gcsfuse pulumi gdal pumba gdb pure-ftpd gdcm pushpin gdk-pixbuf py2cairo gdl pybind11 gdmap pyenv gearsystem pygobject gecode pygobject3 geeqie pygtk gegl pygtkglext gel pygtksourceview genact pypy gengetopt pypy3 genometools pyside geoipupdate qalculate-gtk geos qbs gerbv qca gexiv2 qd ghex qemu ghostscript qmmp ghq qpdf ghr qrupdate gibo qt git-cinnabar quantlib git-cola quazip git-flow-avh quicktype git-fresh quilt git-ftp qwt git-quick-stats r git-recent radare2 git-remote-hg rancid git-review range-v3 git-secret raylib git-town rbspy gitg rclone gitlab-runner rdesktop gitleaks rdup gitless re2 gjs readline gkrellm reattach-to-user-namespace glade rebar3 glances recode glib recon-ng glib-networking recoverjpeg glibmm redis glooctl redo glslang redshift glyr remind gmic reposurgeon gmime reprepro gmsh restview gmt rhino gnome-autoar riemann gnome-builder riff gnome-latex rke gnome-recipes rmlint gnome-themes-standard rocksdb gnu-getopt roll gnu-indent rom-tools gnu-typist root gnu-units roswell gnumeric rpm gnunet rrdtool gnupg rsyslog gnuplot rt-audio gnuradio rtags gnutls rtmidi go rtv goaccess ruby-build gobby rust gobject-introspection rustup-init gobuster s-search godep sassc goffice saxon golang-migrate sbcl gollum scala golo scalapack gom scalariform gomplate sccache goocanvas sceptre goofys schismtracker google-authenticator-libpam scipy google-benchmark scmpuff googler scons gor scrcpy goreleaser scrollkeeper gosu sd gpa sdb gpac sdcc gpgme sdcv gpredict sdl2_ttf gpsbabel sec gpsim serd gqview serf gr-osmosdr serve gradio serverless gradle sfcgal grafana shadowsocks-libev grails shared-mime-info grakn shc graph-tool shfmt graphviz ship grib-api shogun gromacs shpotify groovy shyaml groovysdk silk grpc simple-scan grpcurl simple-tiles grsync sipp gsmartcontrol sipsak gspell siril gssdp sk gst-editing-services skaffold gst-libav skktools gst-plugins-bad skopeo gst-plugins-base sleepwatcher gst-plugins-good sleuthkit gst-plugins-ugly smali gst-python smimesign gst-rtsp-server sn0int gst-validate snownews gstreamer socat gstreamermm sofia-sip gtk+ solr gtk+3 solr@7.7 gtk-chtheme sonar-scanner gtk-doc sonarqube gtk-gnutella sonobuoy gtk-mac-integration sops gtk-vnc source-highlight gtkdatabox source-to-image gtkextra sourcekitten gtkglext sourcery gtkmm spades gtkmm3 sparse gtksourceview sphinx-doc gtksourceview3 spice-protocol gtksourceview4 spin gtksourceviewmm spirv-cross gtksourceviewmm3 sqlcipher gtkspell3 sqlmap gts sratom gucharmap srt guile sshfs gupnp sshtrix gupnp-av sslh gupnp-tools sslscan gwenhywfar sslsplit gwyddion stellar-core gx step gxml stk h3 stout hadolint streamripper hamlib strongswan hana stunnel hapi-fhir-cli subversion harfbuzz suil haskell-stack suite-sparse hbase sundials hdf5 superlu hdf5@1.8 supervisor hebcal swagger-codegen heimdal swagger-codegen@2 helmfile swi-prolog herrie swift-protobuf hexyl swiftformat hfstospell swiftlint highlight swig hlint swimat homeassistant-cli sylpheed homebank sync_gateway httping syncthing hub synfig hugo sysbench hunspell talloc hydra taskell hyperfine tass64 hyperkit tbb hypre tcsh i2pd tdlib iamy teleconsole ibex telegraf icecream teleport imagemagick template-glib imagemagick@6 tepl imageoptim-cli terraform imake terraforming imapsync terragrunt influxdb terrahub inlets testssl interactive-rebase-tool texmath ios-webkit-debug-proxy tfenv iperf3 thefuck ipfs tiger-vnc ipython tika irssi tile38 ispc tippecanoe istioctl tkdiff itk tmux ivykis tmux-xpanes jadx tmuxinator-completion jboss-forge tokei jdnssec-tools tomcat jdupes tomcat@7 jena tomcat@8 jenkins tomee-plus jenkins-job-builder tomee-webprofile jenkins-lts topgrade jfrog-cli-go tor jhipster torsocks jigdo tox jmxterm traefik jnettop trafficserver joplin translate-shell jsdoc3 travis json-fortran treefrog json-glib trezor-agent jsonnet triton jsonschema2pojo ttyd juju tundra just txr jvgrep typescript kafka u-boot-tools kahip ucloud kallisto ufraw kapacitor uhd khal unbound kibana uncrustify kitchen-sync ungit klavaro unp64 knot unrar kobalt unzip kops upscaledb kotlin urdfdom_headers ktlint userspace-rcu kubecfg utf8proc kubeless util-linux kubeprod utimer kubernetes-cli uwsgi kubernetes-helm v8 kubernetes-service-catalog-client vagrant-completion kustomize vala kyoto-cabinet valabind kyoto-tycoon vamp-plugin-sdk lablgtk vault lammps vault-cli landscaper vcdimager lapack vegeta lasi velero lasso verilator laszip vert.x latex2html vfuse latexml vice lazygit viewvc lbdb vim lcdf-typetools vim@7.4 ldapvi vips ldc visp ledger volt lego vowpal-wabbit lensfun vte leveldb vte3 lf vulkan-headers lgogdownloader vultr libb2 wabt libbitcoin wandio libbitcoin-blockchain wartremover libbitcoin-client watchexec libbitcoin-database wdfs libbitcoin-explorer wdiff libbitcoin-network webdis libbitcoin-node webpack libbitcoin-protocol websocat libbitcoin-server websocketd libbluray webtorrent-cli libcddb weechat libcdio wesnoth libcdr wget libchamplain whois libcoap widelands libcroco wildfly-as libdap wimlib libdazzle wine libdc1394 winetricks libebml wiredtiger libedit wireguard-go liberasurecode wireguard-tools libestr wiremock-standalone libetonyek wireshark libev wla-dx libevent wmctrl libfabric wp-cli libfixbuf wp-cli-completion libgaiagraphics wtf libgda wv libgdata wxmaxima libgee wxpython libgeotiff xboard libgit2 xcodegen libglade xctool libglademm xmake libgnomecanvas xmrig libgnomecanvasmm xonsh libgsf xpdf libgtop xplanet libgweather xsane libhttpseverywhere xsimd libical yaf libiconv yamllint libidl yara libidn2 yarn libimagequant yash libinfinity yelp-tools libiptcdata ykman libjson-rpc-cpp ykpers libjwt yle-dl liblas you-get liblinear youtube-dl liblqr yq libltc yubico-piv-tool liblunar z3 libmagic zenity libmatroska zim libmp3splt zimg libmpd zlog libmpdclient zola libmtp zsh-autosuggestions libmwaw zshdb libmypaint zurl ==> Renamed Formulae gnatsd -> nats-server ==> Deleted Formulae compose2kube guile@2.0 scala@2.10 whirr dsd js-test-driver swig@3.04 xmoto erlang@18 minisat tomcat@6 gtk-engines node@6 typesafe-activator gtk-murrine-engine rlvm varnish@4 ==> Installing dependencies for mysql: openssl ==> Installing mysql dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2s.high_sierra. ==> Downloading from https://akamai.bintray.com/b7/b72b8d9e582713d909936d7236542 ######################################################################## 100.0% ==> Pouring openssl-1.0.2s.high_sierra.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" ==> Summary ? /usr/local/Cellar/openssl/1.0.2s: 1,795 files, 12.1MB ==> Installing mysql ==> Downloading https://homebrew.bintray.com/bottles/mysql-8.0.16.high_sierra.bo ==> Downloading from https://akamai.bintray.com/cd/cd3e3fcba5c6c4bd74a0dfd2fc464 ######################################################################## 100.0% ==> Pouring mysql-8.0.16.high_sierra.bottle.tar.gz ==> /usr/local/Cellar/mysql/8.0.16/bin/mysqld --initialize-insecure --user=zhang ==> 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 ==> Summary ? /usr/local/Cellar/mysql/8.0.16: 275 files, 272.7MB ==> `brew cleanup` has not been run in 30 days, running now... Removing: /Users/zhangjingyi/Library/Caches/Homebrew/erlang--21.3.6.high_sierra.bottle.tar.gz... (76.1MB) Removing: /usr/local/Cellar/openssl/1.0.2r... (1,795 files, 12.1MB) Removing: /Users/zhangjingyi/Library/Caches/Homebrew/openssl--1.0.2r.high_sierra.bottle.tar.gz... (3.7MB) Removing: /Users/zhangjingyi/Library/Caches/Homebrew/rabbitmq--3.7.14.tar.xz... (9MB) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/libtiff... (64B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/wxmac... (64B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/libpng... (64B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/erlang... (64B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/rabbitmq... (2 files, 312B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/jpeg... (64B) Removing: /Users/zhangjingyi/Library/Logs/Homebrew/openssl... (64B) Pruned 0 symbolic links and 2 directories from /usr/local ==> 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" ==> mysql 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
先根据提示进行配置,执行命令:
然后启动MySQL
zhangjingyideMacBook-Pro:bin zhangjingyi$ mysql.server start
Starting MySQL
..
SUCCESS!
zhangjingyideMacBook-Pro:bin zhangjingyi$ mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 Please set the password for root here. New password: Re-enter new password: Estimated strength of the password: 25 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y ... Failed! Error: Your password does not satisfy the current policy requirements New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
原因:没有启动MySQL就去初始化密码了,需要先运行MySQL
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。