In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how centos7 compiles and installs mysql, which is very detailed and has certain reference value. Friends who are interested must read it!
Centos7 compilation and installation of mysql methods: 1, install the dependency package; 2, download the corresponding source package; 3, extract the downloaded mysql to the "/ usr/local/mysql" directory; 4, edit "/ etc/my.cnf"; 5, initialize mysql;6, start mysql.
This article operating environment: centos7 system, mysql5.7 version, Dell G3 computer.
Centos7 source code compilation and installation of mysql5.7
In the past, the most annoying is the source code compilation and installation of mysql5.7, the reason is no other-very troublesome, but recently due to learning needs can not be avoided, mainly introduces the source code compilation and installation of mysql5.7 under centos7.
Environment: MiniCentos7 (download address: https://www.centos.org/download/)
Installation
Install dependency packages
Yum install-y gcc gcc-c++ cmake ncurses ncurses-devel bison
Download the appropriate source package
Boost library is required for mysql5.7 compilation and installation. Here, download the source package with boost on the official website.
Download address is provided here
Https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.25.tar.gz
Add user
Useradd-s / sbin/nologin mysql
Establish the required directory and change the owner to mysql
Mkdir-p / data/mysql/datachown-R mysql:mysql / data/mysql
Extract the downloaded mysql to the / usr/local/mysql directory
Tar-zxvf mysql-boost-5.7.25.tar.gz-C / usr/local/mysql/
Change to the / usr/local/mysql directory and compile and install
Cmake-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_BOOST=boost
Make & & make install
/ usr/local/mysql directory structure after installation
Configuration
Edit / etc/my.cnf (create if not)
A configuration file on my side is as follows
[client] port = 3306socket = / tmp/ mysql.sock [mysqld] port = 3306socket = / tmp/mysql.sockuser = mysqlbasedir = / usr/local/mysqldatadir = / data/mysql/datapid-file = / data/mysql/mysql.pidlog_error = / data/mysql/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = / data/mysql/mysql-slow.logskip-external-lockingkey_buffer_size = 32Mmax_allowed_packet = 1024Mtable_open_cache = 128sort_buffer_size = 768Knet_buffer_length = 8Kread_buffer_size = 768Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8Mthread_cache_size = 16query_cache_size = 16Mtmp_table_size = 32Mperformance_schema_max_table_instances = 1000explicit_defaults_for_timestamp = true#skip-networkingmax_connections = 500max_connect_errors = 100open_files_limit = 65535log_bin=mysql-binbinlog_format=mixedserver_id = 232expire_logs_days = 10early-plugin-load = " "default_storage_engine = InnoDBinnodb_file_per_table = 1innodb_buffer_pool_size = 128Minnodb_log_file_size = 32Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 50 [mysqldump] quickmax_allowed_packet = 16m [MySQL] no-auto- rehash [myisamchk] key_buffer_size = 32Msort_buffer_size = 768Kread_buffer = 2Mwrite_buffer = 2m
The above configuration is not necessary, you can make corresponding adjustments according to the actual situation!
Change the installation directory users and groups to mysql
Chown-R mysql:mysql mysql
Change the database data directory users and groups to mysql (database data directory: / data/mysql/data), the method is the same as above!
Note: the / data/mysql/data directory must be empty
Initialize mysql
. / mysqld-initialize-insecure-user=mysql-basedir=/usr/local/mysql-datadir=/data/mysql/data
Note: it is easy to go wrong at this step, the above parameters must be added during initialization, and the / data/mysql/data directory must be empty before performing this step; the basedir and datadir directories specified here must be always with the directory configured by / etc/my.cnf.
Copy executable configuration file
Cp mysql.server / etc/init.d/mysqld
Note: in this step, some netizens will write to copy my-default.cnf from the / usr/local/mysql/support-files directory to / etc/ as the my.cnf configuration file. I don't have this file here, so I configure a my.cnf file directly in the configuration section.
Start
Service mysqld start
Note: this step is also very prone to problems, when there is a problem here, do not panic, look at the contents of the mysql error log, generally according to the mysql error log tips can solve the problem very well.
Test connection
. / mysql-hlocalhost-uroot-p
You can connect successfully without a password
Modify environment variabl
Add a new line in / etc/profile
PATH=/usr/local/mysql/bin:$PATH
Save exit
Source / etc/profile
Set Boot self-boot
Systemctl enable mysqld
The above is all the contents of the article "how centos7 compiles and installs mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.