搭建mysql-5.7.25

创建用户:

groupadd mysql
useradd -m -g mysql mysql

创建目录:

cd /
mkdir -p /data/mysql/mysql3306
cd /data
chown -R mysql:mysql mysql

下载并安装mysql:

mkdir apps
cd /apps
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
tar xzvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.25-linux-glibc2.12-x86_64 mysql-5.7.25
chown -R mysql:mysql mysql-5.7.25
ln -s /apps/mysql5.7.10 mysql

配置文件mysql3306.cnf:

root@NFJD-MMPT-WAPMH-ZX03 local]# vi /data/mysql/mysql3306.cnf
[mysql]
port            = 3306
socket          = /tmp/mysql_3306.sock
default-character-set=utf8

[mysqld]
user=mysql
server-id = 13783306
datadir=/data/mysql/mysql3306
port            = 3306
socket         = /tmp/mysql_3306.sock
skip-name-resolve
default_storage_engine=InnoDB
#federated

#skip-character-set-client-handshake
character_set_server=utf8
collation_server=utf8_unicode_ci
explicit_defaults_for_timestamp=true
transaction_isolation = REPEATABLE-READ

back_log = 150
max_connections = 3000
max_connect_errors = 10

max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
table_open_cache = 2048
thread_cache_size = 8
query_cache_size = 256M
query_cache_limit = 2M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 32M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
thread_stack = 192K
tmp_table_size = 64M

log-bin=mysql-bin
relay_log=mysql-relay-bin
binlog_format=row
log_slave_updates=1
slow_query_log=1
long_query_time = 1
log_bin_trust_function_creators=1

#myisam
myisam_sort_buffer_size = 16M
myisam_max_sort_file_size = 16M
myisam_repair_threads = 1

innodb_file_per_table=1
innodb_file_format=barracuda
innodb_strict_mode=1
innodb_buffer_pool_size = 1G
innodb_data_file_path = ibdata1:12M:autoextend
innodb_log_buffer_size = 8M
innodb_log_file_size = 64M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_flush_method=O_DIRECT
innodb_lock_wait_timeout = 2
innodb_print_all_deadlocks = 1

sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
sync_relay_log = 1
sync_master_info = 1
sync_relay_log_info = 1
master-info-repository  = TABLE
relay-log-info-repository = TABLE

###auto_increment#####
#auto_increment_increment=2
#auto_increment_offset=2

###gtid_mode#######
#gtid-mode=on     
#enforce-gtid-consistency=true

###rpl_semi_sync#######
#rpl_semi_sync_master_enabled=1
#rpl_semi_sync_master_timeout=1000
#rpl_semi_sync_master_trace_level=32
#rpl_semi_sync_master_wait_no_slave=on

[mysqld_safe]
open-files-limit = 8192

初始化密码:

./bin/mysqld --initialize --user=mysql --basedir=/apps/mysql-5.7.25 --datadir=/data/mysql/mysql3306

启动mysql:

./bin/mysqld_safe --defaults-file=/data/mysql/mysql3306.cnf &

登陆mysql:

/apps/mysql-5.7.25/bin/mysql -uroot -p --socket=/tmp/mysql_3306.sock

修改密码:

SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘123’);

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值