mysql 5.7.30安装

1.下载mysql 5.7.30

wget ​​https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.30-linux-mysqlglibc2.12-x86_64.tar.gz​​

2.安装依赖

yum install -y gcc gcc-c++ automake autoconf cmake bison-devellinux删除文件命令 ncurses-devel libaio-devel系统运维工资一般多少

3.解压

cd /usr/local/

tar -xzvf​​mysql-5.7.30-linmysql密码忘记了怎么办ux-gli系统运维工资一般多少bc2.12-x86_6linux命令4.tar.gz​​​ && ln -s​​mysql-linux必学的60个命令5.7.30-linux-glibc2.12-x86_64​​ mysql

4.创建mysql用户与组

mkdir /usr/lmysql安装配置教程ocal/mysql/data

groupadd mysql

useradd -g mysql -s /sbin/nologin mysql

chown -R mysql.mysql /usr/locamysql怎么读l/linux必学的60个命令mysql/data

5.编辑配置文件my.cnf(线上使用)

[mysqld_multi]
#user = root
#pass = 'wg1q2w3e'
mysqld = /usr/local/mysql57/bin/mysqld_safe
mysqladmin = /usr/local/mysql57/bin/mysqladmin

[client]
port = 3306
socket = /tmp/mysql.sock

[mysql]
prompt = "(\u@\h \p) [\d]> "

[mysqld]
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql57
datadir = /usr/local/mysql57/data
character-set-server = utf8mb4
symbolic-links = 0

##### basic settings ####
server-id = 31
max_connections = 2000
max_connect_errors = 6000
skip-external-locking
skip-name-resolve
autocommit = 1
transaction_isolation = READ-COMMITTED

lower_case_table_names = 1
tmp_table_size = 128M
join_buffer_size = 8M
max_allowed_packet = 128M
read_buffer_size = 1M
read_rnd_buffer_size = 1M
sort_buffer_size = 8M
key_buffer_size = 256M
myisam_sort_buffer_size = 16M
myisam_max_sort_file_size = 64M
myisam_repair_threads = 1
bulk_insert_buffer_size = 16M
group_concat_max_len = 10240
max_heap_table_size = 8M
ft_min_word_len = 4
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache_instances = 8
open_files_limit = 65535
back_log = 200
interactive_timeout = 7200
wait_timeout = 7200
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 1M
thread_cache_size = 64
thread_stack = 256K
tmpdir = /tmp/
secure-file-priv = /tmp/
innodb_numa_interleave = 1
sql_mode=NO_UNSIGNED_SUBTRACTION

#### Master Slave ####


#### Thread Pool ####
#thread_handling = pool-of-threads
#thread_pool_high_prio_mode = none
#thread_pool_oversubscribe = 20
#thread_pool_idle_timeout = 28800
#extra_max_connections = 8
#extra_port = 33333

#### Binary Log ####
slow_query_log = 1
long_query_time = 1
slow_query_log_file = mysql-slow.log
log_queries_not_using_indexes = 1
log_throttle_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1

sync_binlog = 1
log-bin = mysql-bin
binlog_format = mixed
log-bin-trust-function-creators = 1
expire_logs_days = 7
log_slave_updates = 1
binlog_cache_size = 8M
binlog_gtid_simple_recovery = 1

#### InnoDB Engine ####
default_storage_engine = InnoDB
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_per_table = 1
innodb_file_format = Barracuda
innodb_open_files = 500
innodb_buffer_pool_size = 2048M
innodb_buffer_pool_instances = 8
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_fast_shutdown = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 1G
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 75
innodb_lock_wait_timeout = 120
innodb_flush_method=O_DIRECT
innodb_adaptive_hash_index = 1
innodb_io_capacity = 1500
innodb_io_capacity_max = 3000
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1
innodb_compression_level = 4

#### Undo tablespace ####
innodb_undo_tablespaces = 4
innodb_purge_threads = 4
innodb_undo_log_truncate = 1
innodb_undo_logs = 128

#### Autoincrement ####
auto_increment_offset = 1
auto_increment_increment = 1

#### Gtid Mode ####
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_checksum = NONE

#### Error Log ####
log_error_verbosity = 3
log_error = mysql-error.log
innodb_print_all_deadlocks = ON
innodb_status_output_locks = ON
log_timestamps = SYSTEM

#### Write Set ####
#transaction_write_set_extraction =XXHASH64
##binlog_transaction_dependency_tracking= WRITESET

#### plugins ####
plugin-load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

#### Semi Replication ####
#loose_rpl_semi_sync_master_enabled = 0
#loose_rpl_semi_sync_slave_enabled = 1
#loose_rpl_semi_sync_master_wait_for_slave_count = 1
#loose_rpl_semi_sync_master_timeout = 5000

#### rmance_Schema ***
performance_schema_instrument ='memory%=counted'

[mysqldump]
quick
max_allowed_packet = 128M

6.初始化(mysqlinux删除文件命令l 5.7之后将mysql_instlinux常用命令all_db改为myqsld了)

/usr/local/mysmysql安装ql/bin/mmysql密码忘记了怎么办ysqld --inmysql怎么读itialize --usemysql数据库命令大全r=mysql --basedir=mysql创建表/usr/local/mysql -linux系统安装-datadir=/usr/local/mysql/datalinux

7.启动

# 启动文件,也可以自己写一个放到/usr/lib/systemd/system/目录

cp /usr/local/mysql57/support-files/linux操作系统基础知识mysql.server /etc/init.d/mysqld

/etc/inilinux删除文件命令t.d/mysqld start

8.修改root默认password

mysqladmin -u root -p password 'wg1q2w3e'
Enter password: 输入初始化时随机生成的password(mysql-error.log里面有记录)