Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[MySQL] standardized installation tutorial

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Introduction:

This article mainly introduces the installation steps of CentOS system binary installation of MySQL version 5.7.23, and the installation process of other versions is similar.

1. Pre-preparation

Uninstall the old MySQL

View the rpm package

Rpm-qa | grep mysql uninstall rpm-e if available

Find the mysql residual package, delete it if you have it, and ignore it if you don't

Find /-name mysql

Installation related dependencies

Yum-y install make gcc-c++ cmake bison-devel ncurses-devel numactl libaio

Create users and user groups

Groupadd mysql

Useradd-s / sbin/nologin-g mysql-M mysql

two。 Download the binary installation package and extract the cd / usr/local/# wget download or download locally upload the wget https://downloads.mysql.com/archives/get/file/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz# decompression installation package tar-zxvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz# after decompression for the convenience of later operation, you can extract the file name Change the chown-R mysql.mysql / usr/local/mysql/3 to which the folder belongs to mysqlmv mysql-5.7.23-linux-glibc2.12-x86_64 mysql#. Create the mysql-related directory mkdir-p / data/mysql/ {data,logs,tmp} # change the chown-R mysql.mysql / data/mysql/4 to which the folder belongs. The simple template for creating the mysql configuration file my.cnfvi / etc/my.cnf# is as follows: [client] port = 3306socket = / data/mysql/tmp/ mysql.sock [mysqld] user = mysqlbasedir = / usr/local/mysql datadir = / data/mysql/data port = 3306socket = / data/mysql/tmp/mysql.sockpid-file = / data/mysql/tmp/mysqld.pidtmpdir = / data/mysql/tmp skip_ Name_resolve = 1symbolic-links=0max_connections = 2000group_concat_max_len = 1024000sql_mode = NO_AUTO_CREATE_USER NO_ENGINE_SUBSTITUTIONlower_case_table_names = 1log_timestamps=SYSTEMcharacter-set-server = utf8interactive_timeout = 1800 wait_timeout = 1800max_allowed_packet = 32Mbinlog_cache_size = 4Msort_buffer_size = 2Mread_buffer_size = 4Mjoin_buffer_size = 4Mtmp_table_size = 96Mmax_heap_table_size = 96Mmax_length_for_sort_data = 8096#logsserver-id = 1003306log-error = / data/mysql/logs/error.logslow_query_log = 1slow_query_log_file = / data/mysql / logs/slow.loglong_query_time = 3log-bin = / data/mysql/logs/binlogbinlog_format = rowexpire_logs_days = 15log_bin_trust_function_creators = 1relay-log = / data/mysql/logs/relay-binrelay-log-recovery = 1relay _ log_purge = 1 # innodb innodb_file_per_table = 1innodb_log_buffer_size = 16Minnodb_log_file_size = 256Minnodb_log_files_in_group = 2innodb_io_capacity = 2000innodb_io_capacity_max = 4000innodb_flush_neighbors = 0innodb_flush_method = O_DIRECTinnodb_autoinc_lock_mode = 2innodb_read_io_threads = 8innodb_write_io_threads = 8innodb_buffer_pool_size = 2G5. Configure mysql.servercd / usr/local/mysql/support-filescp mysql.server / etc/init.d/mysqlvi / etc/init.d/mysql# to modify the directory location basedir=/usr/local/mysqldatadir=/data/mysql/data# registration boot service chkconfig-- add mysqlchkconfig-- list6. Add the environment variable echo "PATH=$PATH:/usr/local/mysql/bin" > / etc/profile source / etc/profile7. Initialize mysql/usr/local/mysql/bin/mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql-- datadir=/data/mysql/data# temporary password stored in errlog # get temporary password more / data/mysql/logs/error.log | grep password8. Start the mysql service and change the password # start the mysql service service mysql start# log in to the mysql service with the initial password and change the password mysql-uroot-palter user 'root'@'localhost' identified by' root';flush privileges

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report