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

Installation tutorial of MySQL under Linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces the MySQL installation tutorial under Linux, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to understand the MySQL installation tutorial under Linux.

Installation requirements

Operating system: CentOS 7.5.1804MySQL version: MySQL 8.0.11 installation: binary installation, installation package name: mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

If the actual installation provides different environments and requirements, the following text is suitable for reference only. (of course, for the old bird, under the premise that there is little difference in operating system version and MySQL version, which is a binary installation, the key to installation is only a few command lines.)

Installation process

Step 1: turn off selinux

Check selinux open status shell > getenforce Enforcing (Enforcing indicates that selinux is on) temporarily close selinuxshell > setenforce 0 check again to confirm that shell > getenforce Permissive (Permissive means that selinux is on, but let everything go, which is considered to be a de facto closed state)

Permanently close selinux

Shell > vim / etc/sysconfig/selinux...SELINUX=disabled...

Step 1 summary: selinux can cause a lot of software installation exceptions, usually by shutting it down directly. The closing methods include temporary closing and permanent closing. The so-called difference between temporary and permanent is whether the modified state of the CVM can be maintained after restart.

Step 2: turn off the firewall

Check the firewall status shell > systemctl status firewalld... Active: active (running). Temporarily turn off firewall shell > systemctl stop firewalld check firewall status shell > systemctl status firewalld...Active: inactive (dead). Permanently turn off firewall shell > systemctl disable firewalld

Step 2 summary: the significance of turning off the firewall is to avoid that the database cannot be accessed by the external network due to port failure. However, the correct use of the firewall can ensure that the firewall is turned on and the database is accessed correctly, so we will not expand it here.

Step 3: install dependencies

Install libaioshell > yum install-y libaio

Step 3 summary: the yum install command is idempotent, which is installed when you use it for the first time, and automatically checks whether it is installed and treated as updated software when you use it at other times, so you can use it boldly. Missing dependency is one of the main reasons for software installation failure, so this step not only can not be omitted, but also increases due to the specific operating system environment.

Step 4: create mysql users and groups

Shell > groupadd mysqlshell > ~] # useradd-r-g mysql-s / bin/false mysql

Step 4 Summary: create unlogged-in mysql users and mysql groups for post-installation permissions management.

Step 5: extract the installation package

Shell > mkdir / applicationshell > cd / application// put the installation package in this directory through the ftp tool shell > tar zxf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz shell > lsmysql-8.0.11-linux-glibc2.12-x86_64 mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

Step 5 summary: essentially, the installation package is unzipped to the / application directory.

Step 6: establish a soft connection

Shell > ln-s / application/mysql-8.0.11-linux-glibc2.12-x86_64 / usr/local/mysql

Step 7: delete the old configuration information

Shell > rm-rf / etc/my.cnf / etc/my.cnf.d/

Step 8: create new configuration information

Shell > vim / etc/my.cnf

[client]

Port = 3306

Socket = / tmp/mysql.sock

[mysqld]

User = mysql

Port = 3306

Basedir = / usr/local/mysql

Datadir = / data/mysql/

Socket = / tmp/mysql.sock

Pid-file = db.pid

Character-set-server = utf8mb4

* * step 8 Summary * *: configuration information is the key to making good use of MySQL. -step 9: initialize

Shell > / usr/local/mysql/bin/mysqld-- initialize-- user=mysql

* * step 9 summary * *: initialization reads the default configuration file (/ etc/my.cnf). Note that there is a temporary password in the output of the process. -step 10: security Enhancement

Shell > / usr/local/mysql/bin/mysql_ssl_rsa_setup

-step 11: start

Shell > / usr/local/mysql/bin/mysqld_safe-- user=mysql &

-step 12: change the password for the first time

Mysql > alter user 'root'@'localhost' identified by' 123456'

Step 13: close

Shell > / usr/local/mysql/bin/mysqladmin-u root-p shutdown

After reading the above tutorials on MySQL installation under Linux, many readers must have some understanding. If you need more industry knowledge and information, you can continue to follow our industry information column.

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