【简易版】mac安装mysql5.7.31
1.mysql下载地址
mysql下载地址
2.安装步骤
案例选择的是5.7.31,可根据自身需要选择版本
打开下载的软件,双击安装,全部点击继续即可
安装时如果提示需要某些权限,选择给予相关权限。安装完毕后一般情况下会自动弹出以下提示框,先不要点ok,把关键信息拷贝出来 0JMF+2-Yo*0s,这个信息为数据库默认初始密码,每次安装得到的初始密码都不相同。
如果没有自动弹出的话可以看看通知栏,如果确认通知栏也没有请看第6点
如果没有看到相关信息的话需要【完全卸载并重启后】重新安装mysql
卸载方法:终端执行以下命令
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
3.记录初始密码,检查是否存在my.cnf文件
官网说明中:从5.7.18开始不在二进制包中提供my-default.cnf文件【5.7.18前的版本可以检查一下 etc 目录下是否存在my.cnf】
执行命令查询文件是否存在 find /etc/my.cnf
如果没有找到相关文件会提示:find: my.cnf: No such file or directory
如果存在文件提示:/etc/my.cnf
案例版本为:5.7.31,经过检查后不存在my.cnf文件
- 执行命令 sudo vim /etc/my.cnf
- 点击i进入编辑模式
- 复制以下内容
- 通过:wq保存
- 执行命令设置文件权限:sudo chmod 664 /etc/my.cnf
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
default-character-set=utf8
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
character-set-server=utf8
init_connect='SET NAMES utf8
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server=utf8
init_connect='SET NAMES utf8'# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin# binary logging format - mixed recommended
binlog_format=mixed# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,
# MASTER_USER=, MASTER_PASSWORD= ;
#
# where you replace , , by quoted strings and
# by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host =
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user =
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port =
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50[mysqldump]
quick
max_allowed_packet = 16M[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=utf8[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeout
再次查询后发现已经存在文件了
4.添加环境变量
执行以下命令
1. vim ~/.zshrc
2. PATH=$PATH:/usr/local/mysql-5.7.31-macos10.14-x86_64/bin
3. 保存
4. 刷新资源:source ~/.zshrc
5.通过初始密码访问数据库,并修改密码
mysql -uroot -p
输入初始密码【输入时,密码不可见,拷贝初始密码后粘贴后直接 enter 即可】
进入 mysql 以后
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
FLUSH PRIVILEGES;
6.没有弹窗,通知也没有的同学看这里
安装完成后,先配置my.cnf,环境变量
先在系统偏好设置-通用关闭mysql
打开终端执行以下命令
cd /usr/local/mysql/bin
sudo mysqld_safe --skip-grant-tables
打开一个新终端 command+N
mysql -u root
成功进入后执行修改密码命令
UPDATE mysql.user SET authentication_string=PASSWORD(‘你想要的密码’) WHERE User=‘root’;
FLUSH PRIVILEGES;
【简易版】mac安装mysql5.7.31相关推荐
- M1芯片处理器mac能用的AI(llustrator CC 2021 直装版M1优化版)解决M1版MAC安装AI闪退问题 完美支持M1芯片处理器
Adobe软件兼容性更新 ,PR/PS/AE/LR/AU等软件已全部支持苹果最新M1芯片 ,搭建可以放心购买m1芯片的苹果电脑了- 苹果公司最新发布的基于M1芯片的Mac笔记本电脑应该很多小伙伴都入手 ...
- Mac M1芯片处理器能用的Bridge 2020/2019 for mac 解决M1版MAC安装BR无法安装问题 完美支持M1芯片处理器
Adobe Bridge 2020 mac功能特色 集中管理您的创意资源. Bridge 是一款功能强大的创意资源管理器,可使您快速轻松地预览.整理.编辑和发布多个创意资源. 编辑元数据.为资源添加关 ...
- MySQL数据库绿色安装 mysql-5.7.31
从 MySQL官网下载 MySQL 解压mysql-5.7.31-winx64.zip 将 MySQL 解压到 D:/Program Files/MySQLMySQL- bin : MySQL数据库命 ...
- 完美解决m1/m1 pro/m1 max版mac安装pyaudio大坑
近期需要做一个语音识别的项目,然而pyaudio一个包耽误了我俩小时...各种找啊,真服了! 首先放解决办法: Mac上安装pyaudio 配置: macbook pro(m1 pro) python ...
- centos7mimi mysql 安装_安装MySQL5.7 安装环境:CentOS7 64位 MINI版,
安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:http://dev.mysql.com/downloads/repo ...
- CentOS7下安装MySQL5.7安装与配置(转)
原文地址:http://www.centoscn.com/mysql/2016/0626/7537.html 安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在M ...
- Windows10安装mysql5.7.17免安装版
Windows10安装mysql5.7.17免安装版 电脑已经安装过mysql的 卸载电脑上的mysql方法: 1.我的电脑–>右键–>属性–>高级系统设置–>环境变量–> ...
- mysql安装 linux 5.6,Linux安装MySql5.6版详细教程
Linux安装MySql5.6版详细教程 Szx • 2019 年 02 月 26 日 首先下载mysql,然后上传到 /usr/local/tmp/下(如果没有这个目录创建一个即可或者存放其他目录) ...
- server2016安装mysql_windows server2016安装MySQL5.7.19解压缩版教程详解
记录了MySQL 5.7.19 winx64解压缩版安装教程,具体内容如下 系统环境:Win7 x64 软件准备:mysql 5.7.19 winx64 配置安装流程 具体安装如下: 1.把 mysq ...
最新文章
- 塞尔达 amiibo数据_塞尔达传说:旷野之息Amiibo道具制作_碧海风云
- 基于Bounding Box的激光点云聚类
- linux常用命令速记
- arcgis for android 无法加载本地jpg影像解决办法
- 易语言 word类excel类 的 源码和模块
- 试用期要盯紧你的“四金”
- carmaker/matlab联合仿真(一) 新建工程,运行自带example
- UPS电源设备消防与电气安全要求
- Anaconda修改默认浏览器
- 云原生落地实践的25个步骤
- Mybatis注解@Results、@Result、@ResultMap
- 2022 高教社杯全国大学生数学建模竞赛获奖名单(初稿)
- 萤石摄像头(C6CN)的安装使用、获取设备的播放地址
- 怎样远程监控污水处理自动化控制系统
- 开放式漏洞评估语言(OVAL)概述
- 用小百合学python
- QQ登录, 腾讯开放平台和QQ互联的坑
- sql server 验证身份证号码有效性
- 只因小黑子的HTML入土过程第四章
- java http头_JAVA如何获取HTTP请求头