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

How to install mysql 5.7.20 on centos6.5

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

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to install mysql 5.7.20 on centos6.5, the editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

1. Virtual machine ready 1.1. VMware Workstation Pro 12.1

Memory: at least 2G is recommended

Hard disk: at least 40g is recommended, dynamic allocation

1.2. Operating system preparation

The operating system is CentOS 6.564bit

IP:192.168.0.11

Hostname: centos65

1.3. MySQL software preparation

Mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz

two。 Pre-installation system environment configuration adjustment 2.1. Close SELinux

To set SELINUX to disabled, you need to restart the system after the setup is complete.

In the Linux operating system, SElinux is the most comprehensive security system, which will have certain restrictions on files and services. The default value of Enforcing is Enforcing, that is, mandatory mode, and setting it to Enforcing may affect the installation and deployment of MySQL and the normal operation after MySQL deployment. It is recommended that you turn off the SELINUX feature of the LINUX operating system and set it to disabled. Execute as root user.

Edit / etc/selinux/config to change SELINUX=Enforcing to SELINUX=disabled

2.2. Turn off the system firewall

View the current status of iptables

Chkconfig-- list | grep iptables

Turn off iptables automatic start

Chkconfig iptables off

2.3. Adjust the Ipaw O scheduling system to deadline mode

The cfq mode is used by default in the Icano scheduling system. It is strongly recommended to use deadline mode here.

View the Icano scheduling file:

[root@centos65 ~] # cat / sys/block/sda/queue/scheduler

Noop anticipatory [deadline] cfq

2.4. Settings for swap Partition

Edit / etc/sysctl.conf, set vm.swappiness=10

Description:

A higher value of swappiness means more active use of swap partitions, and a smaller value means more active use of physical memory. The default is swappiness=60.

For example:

Set 10, which means that 10% of the physical memory is left, and start using swap.

Set 80, which means that 80% of the physical memory is left, and start using swap.

2.5. Operating system limitations

Edit / etc/security/limits.conf, add

Root soft nproc 65536

Root soft nproc 65536

Root soft nofile 65536

Root hard nofile 65536

Mysql soft nproc 65536

Mysql soft nproc 65536

Mysql soft nofile 65536

Mysql hard nofile 65536

2.6. Close numa

To put it simply, by turning off the numa function, you can allocate memory better, and you don't need to use swap to get memory. The reason is that using swap can lead to a sharp decline in database performance. The shutdown method is also closed in BIOS, in the operating system, or during database startup.

3.MySQL installation planning

Package directory: / opt/soft

MySQL home directory / usr/local

MySQL data directory / data/mysql

Configuration file directory / etc/my.cnf

4. Create a directory

Mkdir-p / opt/soft

Mkdir-p / data/mysql

5. Create groups and users

Groupadd mysql

Useradd-g mysql mysql-s / sbin/nologin

Passwd mysql-password is oracle123

6. Install MySQL softwar

Cd / opt/soft

Tar-xzf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz

Mv mysql-5.7.20-linux-glibc2.12-x86_64 / usr/local

Cd / usr/local

Ln-s mysql-5.7.20-linux-glibc2.12-x86_64 mysql

Chown-R mysql:mysql / usr/local/mysql

Chown-R mysql:mysql / data/mysql

7. Edit parameter file

[client]

Port = 3306

Socket = / tmp/mysql.sock

[mysql]

Prompt= "\ u@db\ R:\ m:\ s [\ d] >"

No-auto-rehash

[mysqld]

User = mysql

Port = 3306

Basedir = / usr/local/mysql

Datadir = / data/mysql

8.mysql database initialization

Cd / usr/local/mysql/bin

. / mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/data/mysql

Because the log-error parameter is not set during initialization, the resulting temporary password will be output on the screen, for example, the temporary password is: WSes0roomQdolfC

If the log-error parameter is set in the parameter file, the temporary password is recorded in the error log file.

9. Start the mysql instance

Cd / usr/local/mysql/bin

. / mysqld_safe-- defaults-file=/etc/my.cnf &

10. Change login password

/ usr/local/mysql/bin/mysqladmin-uroot-p password

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