Home Database Mysql Tutorial Detailed explanation of how to install MySQL5.7.18 under centos system

Detailed explanation of how to install MySQL5.7.18 under centos system

Feb 02, 2020 pm 07:03 PM
centos

Detailed explanation of how to install MySQL5.7.18 under centos system

1. First install the dependency package

yum install -y gcc gcc-c++ ncurses-devel perl openssl-devel
Copy after login

The most important thing is, don’t forget to install openssl-devel

(free learning video tutorial recommended : mysql video tutorial)

2. Install cmake

tar -xzvf cmake-3.8.1.tar.gz   
cd cmake-3.8.1  
./bootstrap
make && make install
Copy after login

3. Install MySQL5.7.18

First download the installation package. My installation version is :mysql-boost-5.7.18.tar.gz

You need to download boost. I am matching the boost_1_59_0 version

Download, decompress it in the /usr/local directory, and rename it to boost

First add the system account corresponding to MySQL to ensure its local file permission allocation:

groupadd mysql
useradd -r -g mysql mysql
Copy after login

Create the database directory:

mkdir -p /var/mysql/data
chown mysql:mysql /var/mysql/data
Copy after login

Enter the decompressed MySQL installation package:

cd mysql-boost-5.7.18
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DINSTALL_DATADIR=/usr/local/mysql/data/master \
-DSYSCONFDIR=/usr/local/mysql/etc \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_USER=mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost
Copy after login

If an error occurs, after modification, you need to delete the CMakeCache.txt file in the current directory, and then restart cmake

make && make install
Copy after login

After completing the above steps, you need to change the owner of the mysql installation directory. For example, the directory we installed is /usr/local/mysql. Use the command

chown -R mysql:mysql /usr/local/mysql
Copy after login

to modify the directory owner. At this time, copy a copy of the default configuration file

cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
Copy after login

After the blogger has completed the installation, there is no my-default.cnf file. You need to create it yourself. Attach the content of the file:

#For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
#aracter_set_server=utf8
#init_connect='SET NAMES utf8' 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
# 一般配置选项
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/master
port = 3306
socket = /usr/local/mysql/data/mysql.sock
character-set-server=utf8
back_log = 300
max_connections = 3000
max_connect_errors = 50
table_open_cache = 4096
max_allowed_packet = 32M
#binlog_cache_size = 4M
max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
#log-bin=mysql-bin
long_query_time = 6
server_id=1
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 16
innodb_log_buffer_size = 16M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
[mysqldump]
quick
max_allowed_packet = 32M
[mysql]
no-auto-rehash
default-character-set=utf8
safe-updates
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
[client]
port=3306
socket=/usr/local/mysql/data/mysql.sock
#default-character-set=utf8
Copy after login

If the prompt already exists If the file is overwritten, just overwrite it.

Then perform the initialization operation of the database.

/usr/local/mysql/bin/mysqld --initialize --user=mysql,
Copy after login

At this time, the database will be initialized and a database root account will be created. However, please note that this account has a default password. During initialization, the screen will Output the initialized password. If you missed it, you can see the default password by looking at /root/.mysql_secret.

Execute cp /usr/local/mysql/support-files/mysql.server /etc/init.d, copy the mysql service startup script, and then execute service mysql.server start to start mysql.

Finally /usr/local/mysql/bin/mysql -rroot -p, enter the password and press Enter. If Access denied for user 'root'@'localhost' (using password: YES) appears, under normal circumstances

service mysql.server restart Restart

After passing, you can use the following command to reset the root password

set password=password('你的密码');
Copy after login

At this point, the basic installation process is completed

The following method can be used to set up the startup

Commandecho "service mysqld start" >> /etc/rc.local

Or enter the /etc/ directory, Directly edit the rc.local file with vim rc.local, add "service mysqld start" in the last line, save and exit.

The above is the detailed content of Detailed explanation of how to install MySQL5.7.18 under centos system. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the backup methods for GitLab on CentOS What are the backup methods for GitLab on CentOS Apr 14, 2025 pm 05:33 PM

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

How to check CentOS HDFS configuration How to check CentOS HDFS configuration Apr 14, 2025 pm 07:21 PM

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

Centos configuration IP address Centos configuration IP address Apr 14, 2025 pm 09:06 PM

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

What are the common misunderstandings in CentOS HDFS configuration? What are the common misunderstandings in CentOS HDFS configuration? Apr 14, 2025 pm 07:12 PM

Common problems and solutions for Hadoop Distributed File System (HDFS) configuration under CentOS When building a HadoopHDFS cluster on CentOS, some common misconfigurations may lead to performance degradation, data loss and even the cluster cannot start. This article summarizes these common problems and their solutions to help you avoid these pitfalls and ensure the stability and efficient operation of your HDFS cluster. Rack-aware configuration error: Problem: Rack-aware information is not configured correctly, resulting in uneven distribution of data block replicas and increasing network load. Solution: Double check the rack-aware configuration in the hdfs-site.xml file and use hdfsdfsadmin-printTopo

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

See all articles