引言
最近发现运维同时安装常用的软件非常的快,但是回想之前自己安装的时候 比较麻烦,每次都得查一些资料,所以决定弄一些安装教程,特此在记录,纯属记录,没有技术含量。
1、上传下载好的安装包到指定目录 2、yum install libaio libaio-devel 3、yum -y install numactl 4、tar zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz 5、mv mysql-5.7.21-linux-glibc2.12-x86_64 /usr/local/mysql57 6、groupadd mysql 7、useradd -r -g mysql mysql 8、[root@iZ25fpoaflxZ mysql57]# id mysql uid=501(mysql) gid=502(mysql) groups=502(mysql) 9、[root@iZ25fpoaflxZ mysql57]# mkdir -p /data/mysql3306/data/ 10、[root@iZ25fpoaflxZ mysql57]# chown -R mysql.mysql /data/mysql3306 11、[root@iZ25fpoaflxZ mysql57]# chmod 750 /data/mysql3306/data 12、[root@iZ25fpoaflxZ mysql57]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql57 --datadir=/data/mysql3306/data 2018-12-07T02:37:59.719825Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-12-07T02:38:00.653053Z 0 [Warning] InnoDB: New log files created, LSN=45790 2018-12-07T02:38:00.782312Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2018-12-07T02:38:00.853061Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1d349e4b-f9c9-11e8-b82e-00163e106c1b. 2018-12-07T02:38:00.858277Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2018-12-07T02:38:00.858879Z 1 [Note] A temporary password is generated for root@localhost: IESd#EfJj4zr 注意:这是默认密码 13、[root@iZ25fpoaflxZ mysql57]# vim ./support-files/mysql.server #填入 basedir=/usr/local/mysql57 datadir=/data/mysql3306/data 14、cp -a ./support-files/mysql.server /etc/init.d/mysqld 15、[root@iZ25fpoaflxZ mysql57]# vim /etc/my.cnf 直接复制下面内容 注意目录 [mysql] prompt="\\u@mysql3306:\\p:[\\d] \\R:\\m:\\s>" no-auto-rehash default_character_set = utf8 user=zabbix password=ZabbiX.MySQL socket=/tmp/mysql3306.sock [mysqld] socket=/tmp/mysql3306.sock port=3306 user = mysql pid-file = ai-mysql-005.pid character_set_server = utf8 basedir=/usr/local/mysql57 datadir=/data/mysql3306/data log_bin = /data/mysql3306/logs/mysql-bin log-error = /data/mysql3306/data/error.log tmpdir = /data/mysql3306/tmp slow_query_log = 1 long_query_time = 2 lower_case_table_names=1 innodb_file_per_table=1 max_allowed_packet = 1024M net_read_timeout = 86400 net_write_timeout = 86400 max_connections = 10000 max_user_connections = 0 thread_cache_size = 200 #tmp_table_size = 32M #max_heap_table_size = 32M tmp_table_size = 500M max_heap_table_size = 500M sort_buffer_size = 16M join_buffer_size = 16M read_rnd_buffer_size = 64M read_buffer_size = 16M wait_timeout = 300 interactive_timeout = 300 binlog_cache_size = 4M expire_logs_days = 30 innodb_log_file_size = 256M innodb_log_files_in_group = 2 innodb_buffer_pool_size = 1G innodb_buffer_pool_instances=8 master_info_repository = table relay_log_info_repository = table server-id=2 slave-skip-errors = all innodb_flush_log_at_trx_commit=1 sync_binlog=1 gtid-mode=on enforce-gtid-consistency=1 binlog_format = ROW transaction_isolation = READ-COMMITTED innodb_flush_method = O_DIRECT sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION secure_file_priv=/tmp slave-parallel-type=LOGICAL_CLOCK slave-parallel-workers=16 master_info_repository=TABLE relay_log_info_repository=TABLE relay_log_recovery=ON 16、[root@iZ25fpoaflxZ mysql57]# touch /data/mysql3306/data/error.log 17、[root@iZ25fpoaflxZ mysql57]# mkdir /data/mysql3306/tmp 18、[root@iZ25fpoaflxZ mysql57]# mkdir /data/mysql3306/logs 19、[root@iZ25fpoaflxZ mysql57]# chown -R mysql.mysql /data/mysql3306 20、[root@iZ25fpoaflxZ mysql57]# service mysqld start 21、[root@iZ25fpoaflxZ mysql57]# ./bin/mysql -uroot -pq0lU5cch9l.R 注意密码 22、root@mysql3306:mysql3306.sock:[(none)] 10:52:24>set password=password("jack@2018"); Query OK, 0 rows affected, 1 warning (0.01 sec) 23、root@mysql3306:mysql3306.sock:[(none)] 10:53:41>grant all on *.* to 'root'@'localhost' identified by 'jack@2018'; Query OK, 0 rows affected, 1 warning (0.00 sec) 24、root@mysql3306:mysql3306.sock:[(none)] 10:54:34>grant all on *.* to 'root'@'%' identified by 'jack@2018'; Query OK, 0 rows affected, 1 warning (0.01 sec) root@mysql3306:mysql3306.sock:[(none)] 10:54:49>
在安装过程中主要自己的路径及配置参数
上面教程在全新的腾讯云机器上测试通过。