Mac安装mysql8.0.12

···shell

下载

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.12-macos10.13-x86_64.tar.gz
tar -xzvf mysql-8.0.12-macos10.13-x86_64.tar.gz

移动到合适的位置

mv mysql-8.0.12-macos10.13-x86_64 ../mysql8.0.12
cd ../mysql8.0.12/

创建数据目录

mkdir data
cd data
mkdir binlog data innodb tmp

添加配置文件

vi my8.cnf

初始化

bin/mysqld --defaults-file=/Users/liwenjie01/mysql8.0.12/my8.cnf --initialize-insecure --user=liwenjie01 --basedir=/Users/liwenjie01/mysql8.0.12 --datadir=/Users/liwenjie01/mysql8.0.12/data/data

启动服务

bin/mysqld_safe --defaults-file=/Users/liwenjie01/mysql8.0.12/my8.cnf --user=liwenjie01 &

登录

bin/mysql -S /Users/liwenjie01/mysql8.0.12/data/mysql8.sock -uroot -p

设定新账号后再登录

bin/mysql -S /Users/liwenjie01/mysql8.0.12/data/mysql8.sock -umysql -pmysql
···

配置参考

···mysql
client]
port = 3307
socket = /Users/liwenjie01/mysql8.0.12/data/mysql8.sock

[mysql]
default-character-set = utf8mb4
no-auto-rehash

[mysqld]
port=3307
server_id=8
max_connections=3000

datadir=/Users/liwenjie01/mysql8.0.12/data/data
tmpdir=/Users/liwenjie01/mysql8.0.12/data/tmp
socket =/Users/liwenjie01/mysql8.0.12/data/mysql8.sock

log-error =/Users/liwenjie01/mysql8.0.12/data/mysqld8.log
pid-file =/Users/liwenjie01/mysql8.0.12/data/mysqld8.pid

log_bin=/Users/liwenjie01/mysql8.0.12/data/binlog/jay-bin
log-bin-index=/Users/liwenjie01/mysql8.0.12/data/binlog/mysql-bin.index
relay-log=/Users/liwenjie01/mysql8.0.12/data/binlog/localhost-relay-bin

default_authentication_plugin=mysql_native_password #使用5.7以前的加密方式

default_storage_engine=Innodb
default_tmp_storage_engine=Innodb
core_file
general_log=OFF
slow_query_log=ON
long_query_time=2

sync_binlog=0

log_slave_updates=ON
slave_net_timeout=3600

binlog_format=ROW
binlog_row_image=FULL

relay_log_recovery=1
master_info_repository=TABLE
relay_log_info_repository=TABLE
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=8

innodb_io_capacity=2000
innodb_io_capacity_max=20000
innodb_write_io_threads=16

key_buffer_size=128M
myisam_mmap_size=12M

tmp_table_size=3M
sort_buffer_size=3M
max_heap_table_size=3M
join_buffer_size=3M

bulk_insert_buffer_size=3M

explicit_defaults_for_timestamp=ON

innodb_data_home_dir=/Users/liwenjie01/mysql8.0.12/data/innodb
innodb_file_per_table=ON

innodb_buffer_pool_size=32G
innodb_sort_buffer_size=32M

innodb_log_group_home_dir=/Users/liwenjie01/mysql8.0.12/data/innodb
innodb_log_files_in_group=3
innodb_log_file_size=128M
innodb_log_buffer_size=32M
innodb_flush_log_at_trx_commit=1
innodb_flush_method=O_DIRECT

innodb_print_all_deadlocks=ON

wait_timeout=604800
interactive_timeout=604800

···

posted @ 2018-09-04 19:56  FEFJay  阅读(468)  评论(0编辑  收藏  举报