美文网首页
MacBook安装Mysql

MacBook安装Mysql

作者: beyond阿亮 | 来源:发表于2021-11-06 22:12 被阅读0次

MacBook安装Mysql

Mysql官方下载地址: https://dev.mysql.com/downloads/mysql/

官方下载 MySQL Community Server 社区版
选择对应的版本和系统下载: mysql-5.7.22-macos10.13-x86_64.dmg
点击安装 注意安装过程会弹出 密码 需要记住密码
在设置里最下面找到mysql 打开后启动,这里我把开机自动启动给去掉了

#Mysql命令添加到环境变量里
vim ~/.zshrc 
#最后加入 
export MYSQL_HOME=/usr/local/mysql
export PATH=$MYSQL_HOME/bin:$PATH

#使配置生效 
source ~/.zshrc

#查看mysql版本
mysql —version

#修改密码
mysql -u root -p
#输入之前保存的密码

#设置新密码 如:123456
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('123456');

#设置远程连接授权
grant all privileges on *.* to 'root'@'%' identified by '123456';

flush privileges;

#修改mysql配置  查看编码
show variables like '%char%';

#新版本的mysql 安装目录下没有默认配置文件了 /usr/local/mysql/support-files  可以从其他地方复制一份过来

mysql配置文件

sudo vim /etc/my.cnf
#查看配置
cat my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET  NAMES utf8mb4'

basedir = /data/soft/mysql-5.7.16
datadir = /data/datas/mysql/data

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

port = 3306
server_id = 212
binlog-ignore-db = mysql,sys,information_schema,performance_schema
log-bin = mysql-bin

max_binlog_size = 500M
binlog_cache_size = 2M
max_binlog_cache_size = 4M
expire_logs_days = 30
max_connections = 500
max_connect_errors = 10000
table_open_cache = 256
long_query_time = 1
slow-query-log
slow_query_log_file = /data/datas/mysql/data/slow_query_log_file.log

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

#timezone='UTC'

#修改完后重启mysql服务
#再次查看编码
show variables like '%char%';

参考链接:
https://blog.csdn.net/catstarxcode/article/details/78940385
https://www.jianshu.com/p/a8e4068a7a8a
https://www.jianshu.com/p/438bbcd26bea
https://blog.csdn.net/u010281209/article/details/53965409

相关文章

  • MacBook安装Mysql

    MacBook安装Mysql Mysql官方下载地址: https://dev.mysql.com/downloa...

  • 从零开始搞定MySQL

    从零开始搞定MySQL 一、如何在Macbook上安装MySQL https://jingyan.baidu.co...

  • macbook 安装mysql

    一、下载 在mysql官网选择合适的版本,下载。 二、安装 安装步骤直接下一步下一步就可以了,到最后一步时,记下 ...

  • macbook安装mysql

    1.mysql官网下载社区版本: 在该文件中添加 保存并退出,然后执行以下命令: 在终端输入命令: 出现下图所示则...

  • macbook安装mysql

    mysql MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于Oracle旗下产品。...

  • Mac上的文件操作问题

    最近在MacBook电脑上搞wordpress,手动安装apache,mysql,php。总算在各种网络帖...

  • mac版mysql安装后显示mysql: command not

    macbook安装好mysql,并按照各路大神的说明进行了以下配置。 打开Terminal,输入:vim .bas...

  • MacOS上安装多版本的MySQL

    背景: 原先我的macbook上装的mysql是用brew无脑安装的: 但是mysql8.0比较蛋疼,一方面是非常...

  • MacBook之brew安装mysql

    如果想重新安装mysql必须先卸载老mysql安装文件。 下面开始重新安装mysql,第二句意思是设置mysql为...

  • Macbook air OS X Yosemite10.10.5

    记录下折腾了一天终于把MYSQL给装了,坎坷啊! 安装环境: 系统:Macbook air OS X Yose...

网友评论

      本文标题:MacBook安装Mysql

      本文链接:https://www.haomeiwen.com/subject/inhszltx.html