MySQL 5.7安装最佳实践(2)


####: for innodb
innodb_data_file_path =ibdata1:100M:autoextend # ibdata1:12M:autoextend
innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend
innodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_pool
innodb_log_group_home_dir =./ # ./
innodb_log_files_in_group =3 # 2
innodb_log_file_size =100M # 50331648(48M)
innodb_file_per_table =on # on
innodb_online_alter_log_max_size =128M # 134217728(128M)
innodb_open_files =65535 # 2000
innodb_page_size =16k # 16384(16k)
innodb_thread_concurrency =0 # 0
innodb_read_io_threads =4 # 4
innodb_write_io_threads =4 # 4
innodb_purge_threads =4 # 4(垃圾回收)
innodb_page_cleaners =4 # 4(刷新lru脏页)
innodb_print_all_deadlocks =on # off
innodb_deadlock_detect =on # on
innodb_lock_wait_timeout =20 # 50
innodb_spin_wait_delay =128 # 6
innodb_autoinc_lock_mode =2 # 1
innodb_io_capacity =200 # 200
innodb_io_capacity_max =2000 # 2000
#--------Persistent Optimizer Statistics
innodb_stats_auto_recalc =on # on
innodb_stats_persistent =on # on
innodb_stats_persistent_sample_pages =20 # 20

innodb_change_buffer_max_size =25 # 25
innodb_flush_neighbors =1 # 1
#innodb_flush_method = #
innodb_doublewrite =on # on
innodb_log_buffer_size =128M # 16777216(16M)
innodb_flush_log_at_timeout =1 # 1
innodb_flush_log_at_trx_commit =1 # 1
innodb_buffer_pool_size =100M # 134217728(128M)
innodb_buffer_pool_instances =4
#--------innodb scan resistant
innodb_old_blocks_pct =37 # 37
innodb_old_blocks_time =1000 # 1000
#--------innodb read ahead
innodb_read_ahead_threshold =56 # 56 (0..64)
innodb_random_read_ahead =OFF # OFF
#--------innodb buffer pool state
innodb_buffer_pool_dump_pct =25 # 25
innodb_buffer_pool_dump_at_shutdown =ON # ON
innodb_buffer_pool_load_at_startup =ON # ON
innodb_flush_method = O_DIRECT

4、初始化安装,error日志查看
[root@localhost ~]# /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize
[root@localhost ~]# more /data/mysql/mysql3306/data/error.log
没有error就表示初始化完成了。

5、启动,error日志查看
[root@localhost ~]# /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf &
[root@localhost ~]# more /data/mysql/mysql3306/data/error.log
没有error就表示初始化完成了。

6、配置环境变量,root密码修改,配置远程连接权限
[root@localhost ~]# echo export PATH=$PATH:/usr/local/mysql/bin >>/etc/profile
[root@localhost ~]# source /etc/profile
[root@localhost ~]# more /data/mysql/mysql3306/data/error.log |grep password
2018-12-28T09:56:30.709446+08:00 1 [Note] A temporary password is generated for root@localhost: K:5+d=MqRqlc
root用户的临时密码为:K:5+d=MqRqlc

[root@localhost ~]# mysql -S /tmp/mysql3306.sock -p
Enter password: 【这里输入上面的临时密码】
(unknown)@localhost [(none)]>set global super_read_only=0; set global read_only=0;
(unknown)@localhost [(none)]>alter user user() identified by 'root';
Query OK, 0 rows affected (0.05 sec)

root@localhost [(none)]>
配置远程连接权限 略

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/6253821b8d7ed4da06797d80b5bd6eea.html