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 5.7installation

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

Share

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

Description:

Database, presumably there is no need to declare more. In the database, the data is stored in a unified format in the form of "records". It mainly has the following characteristics:

1. A large amount of data and information can be stored structurally, which is convenient for users to retrieve and access effectively.

2. It can effectively maintain the consistency and integrity of data information and reduce data redundancy.

3. It can meet the requirements of application sharing and security.

Next, for the installation steps of the database, give an example

Lab requirements: a centos7 virtual machine for installing MySQL

.

.

Download the source package in the second step

Link: https://pan.baidu.com/s/19h2l3bSK1gv7cGUDk7zpOQ password: yvjq

.

.

1. First, the environment is deployed, provided that the host is connected to the network and the virtual network card is in NAT mode.

Yum install ncurses ncurses-devel bison cmake gcc gcc-c++-y

.

.

2.

Useradd-s / sbin/nologin mysql # Settings to manage MySQL service process users

Mkdir / / uuu

Mount.cifs / / 192.168.200.1/gx / uuu # Mount the local installation source into the virtual machine

Cd / uuu/

Tar zxvf mysql-5.7.17.tar.gz-C / /

Decompress tar zxvf boost_1_59_0.tar.gz-C / usr/local/ #

.

.

3 .cd / usr/local/

Mv boost_1_59_0 boost # renames files for ease of operation

.

.

4. Cd / mysql-5.7.17/

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # installation directory

-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ # Communication file

-DSYSCONFDIR=/etc\ # the directory where the configuration file is located

-DSYSTEMD_PID_DIR=/usr/local/mysql\ # process file

-DDEFAULT_CHARSET=utf8\ # character set

-DDEFAULT_COLLATION=utf8_general_ci\ # character set

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_ARCHIVE_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\ # Storage engine

-DMYSQL_DATADIR=/usr/local/mysql/data\ # Database file

-DWITH_BOOST=/usr/local/boost\ # support library

-DWITH_SYSTEMD=1

# will generate a file

.

.

5. Here's the installation of make & & make install, which takes a long time.

.

.

6. After installation is complete

Chown-R mysql:mysql / usr/local/mysql/ # change group permissions

.

.

7. Make profile settings

Vim / etc/my.cnf

At the top, insert the following

[client]

Port = 3306

Default-character-set=utf8

Socket = / usr/local/mysql/mysql.sock

[mysql]

Port = 3306

Default-character-set=utf8

Socket = / usr/local/mysql/mysql.sock

Delete the following example 9 line and reinsert it as follows

[mysqld]

User = mysql # Administrative user

Basedir = / usr/local/mysql # working directory

Datadir = / usr/local/mysql/data # database file

Port = 3306 # Port

Character_set_server=utf8 # character set

Pid-file = / usr/local/mysql/mysqld.pid # process file

Socket = / usr/local/mysql/mysql.sock # connection file

Server-id = 1 # itself id

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES

# support mode

.

.

8. Cd / etc/

Chown mysql:mysql / etc/my.cnf # Grant permissions

Echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profile # will recognize the command and add to the system environment variable

Echo 'export PATH' > > / etc/profile

The source / etc/profile # command takes effect

.

.

9. Initialize the database

Cd / usr/local/mysql/

Bin/mysqld\

-- initialize-insecure\ # automatically generates a password, which is empty

-- user=mysql\ # manage users

-- basedir=/usr/local/mysql\ # specify the working directory

-- datadir=/usr/local/mysql/data # specify the data file directory

.

.

10. Cd / usr/local/mysql/usr/lib/systemd/system/

Cp mysqld.service / usr/lib/systemd/system/ # copy files to the specified directory

Systemctl daemon-reload # Refresh recognition

Systemctl start mysqld # launch mysql

Systemctl stop firewalld.service # turn off the firewall

Setenforce 0

Mysqladmin-u root-p password "qwe123" # set the password for the root account to qwe123 prompt for the original password.

.

.

11. Mysql-u root-p # Login using the root user

You can log in, and the database is installed successfully

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