标签:nofile 防止 intern rect thread basedir relay_log perl auth
安装包mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz vim /etc/sysconfig/selinux
SELINUX = disabled
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
getenforce
setenforce 0
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
groupadd mysql
useradd mysql -s /sbin/nologin -M
ln -s /usr/local/src/mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql
chown mysql:mysql -R mysql
5.创建数据库目录,授予权限
mkdir -p /data/mysql
chown mysql:mysql -R /data/mysql
6.初始化数据库,指定data目录
yum install -y perl-Data-Dumper.x86_64
yum install libaio*
如果之前已经安装过数据库
mysqld --no-defaults --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
记住密码
···
7 .启动
scp support-files/mysql.server /etc/init.d/mysqld
vim /etc/init.d/mysqld
datadir = /data/mysql
/etc/init.d/mysql start
8.常用mysql命令
修改密码
alter user user() identified by "123456";
flush privileges;
开启远程登录
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
flush privileges;
查看mysql 的用户名密码
select host,user,authentication_string from mysql.user;
my.cnf(16G)
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
auto-rehash
prompt = "\\u@\\h \\d>"
[mysqld]
user = mysql
port = 3306
basedir = /usr/local/mysql
datadir = /data/mysql/
socket = /tmp/mysql.sock
pid-file = /data/mysql/mysql.pid
character_set_server = utf8mb4
skip_name_resolve = 1
skip-external-locking
open_files_limit = 65535
back_log = 600
max_connections = 3000
max_connect_errors = 600000
table_open_cache = 5120
table_definition_cache = 1024
table_open_cache_instances= 64
thread_stack = 512k
external-locking =FALSE
max_allowed_packet = 512M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 300
query_cache_size = 64M
query_cache_limit = 4M
query_cache_min_res_unit = 2k
default_storage_engine = InnoDB
explicit_defaults_for_timestamp = 1
#skip-networking
interactive_timeout = 1800
wait_timeout = 1800
tmp_table_size = 32M
max_heap_table_size = 256M
slow_query_log = 1
slow_query_log_file = /data/mysql/mysql-slow.log
long_query_time = 2
log_error = /data/mysql/error.log
server-id = 3306101
log-bin = /data/mysql/mysql-bin
sync_binlog = 1
expire_logs_days = 14
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = row
relay_log_recovery = 1
relay_log_purge = 1
relay-log = /data/mysql/relay-bin
relay-log-info-file = /data/mysql/relay-log.info
binlog_cache_size = 16M
max_binlog_cache_size = 8M
max_binlog_size = 512M
key_buffer_size = 32M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 32M
lock_wait_timeout = 3600
#explict_defaults_for_timestamp = 1
#explict_defaults_for_timestamp=1
lower_case_table_names = 1
slave-skip-errors = 1032,1062
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
innodb_thread_concurrency = 0
innodb_sync_spin_loops = 100
innodb_spin_wait_delay = 30
transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_data_file_path = ibdata1:12M:autoextend
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 20M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_undo_log_size = 4G
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_flush_neighbors = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_open_files = 65535
innodb_max_dirty_pages_pct = 90
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32
innodb_lock_wait_timeout = 120
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_online_alter_log_max_size = 4G
internal_tmp_disk_storage_engine = InnoDB
[mysqldump]
quick
max_allowed_packet = 32M
标签:nofile 防止 intern rect thread basedir relay_log perl auth
原文地址:http://blog.51cto.com/12473494/2316256