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

Specific steps for installing a MySQL database using a source package

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

Share

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

Let me give you a brief introduction to the specific steps of using the source package to install the MySQL database. Have you learned about similar topics before? If you are interested, let's take a look at this article. I believe it will be of some help to you after reading the specific steps of installing the MySQL database using the source package.

Experimental environment

System environment: centos 7

Host IP address: 192.168.100.201

Yum mount directory: / mnt/sr0

Related source package link: https://pan.baidu.com/s/1f3v-qM-vwK-nT-EKEScZkQ password: T927

The minimum installation directory space of the mysql-5.7.17.tar.gz package is not less than 8G, otherwise the alarm space will be insufficient after the completion of make!

Experimental goal

Build the basic service of MySQL database

Experimental procedure

1. Install the environment package

Yum-y install\

Ncurses\ # provides character terminal processing library

The basic library of screen control under ncurses-devel\ # character terminal

Parser for bison\ # gcc gcc-c++

Cmake # cross-platform installation tool

two。 Source code compilation and installation

(1) create an operating account

Useradd-s / sbin/nologin mysql

(2) unpacking

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

Tar zxvf boost_1_59_0.tar.gz-C / usr/local/ # C++ Runtime

The path that cd / usr/local/ # needs to point to for easy identification

Mv boost_1_59_0 boost # rename

(3) configuration

Cd mysql-5.7.17/

Cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # installation directory-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ # connection file-DSYSCONFDIR=/etc\ # mysql configuration file exists path-DSYSTEMD_PID_DIR=/usr/local/mysql\ # path to the process file-DDEFAULT_CHARSET=utf8\ # Character set-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_INNOBASE_STORAGE_ENGINE=1\ # Storage engine-DWITH_ARCHIVE_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\-DMYSQL_DATADIR=/usr/local/mysql/data\ # path to the database file-DWITH_BOOST=/usr/local/boost\ # supports the C++ runtime-DWITH_SYSTEMD=1 # enables the system to support mysql

(4) compilation and installation

Make & & make install

Note: this process takes a long time to wait, about 40 minutes, so be psychologically prepared!

3. Adjustment after installation

(1) set permissions on the database directory

[root@localhost etc] # chown mysql:mysql / etc/my.cnf

[root@localhost etc] # ls-l | grep "my.cnf" # View permission

-rw-r--r--. 1 mysql mysql 728 August 23 02:15 my.cnf # permissions have been changed to mysql

Drwxr-xr-x. 2 root root 31 July 28 04:14 my.cnf.d

(2) establish a configuration file

[root@localhost mysql-5.5.24] # cp support-files/my-medium.cnf / etc/my.cnf # create configuration file

[root@localhost mysql-5.5.24] # vim / etc/my.cn # modify configuration file

[client] # client

Port = 3306

Default-character-set=utf8

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

[mysql] # server

Port = 3306

Default-character-set=utf8

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

[mysqld] # set for the service itself

User = mysql

Basedir = / usr/local/mysql

Datadir = / usr/local/mysql/data

Port = 3306

Character_set_server=utf8

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

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

Server-id = 1

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

(3) initialize the database

Cd / usr/local/mysql/

Bin/mysqld\

-- initialize-insecure\ # generate database password, empty

-- user=mysql\

-- basedir=/usr/local/mysql\

-- datadir=/usr/local/mysql/data

(4) set environment variables

Echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profile # environment variable file

Echo 'export PATH' > > / etc/profile # sets the global mode

Source / etc/profile # execution to make it effective

4. Add system services

Cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/ # replication startup script

Systemctl daemon-reload # refresh recognition startup script

Systemctl start mysqld # launch MySQL

Netstat-anpt | grep 3306 # View Port

[root@localhost mysql] # netstat-anpt | grep 3306

Tcp6 0 0:: 3306: *

Systemctl enable mysqld # add Boot Auto Boot

Mysqladmin-u root-p password "abc123" # set login password

Mysql-uroot-p123 # Log in to mysql

5. Implement remote login

Grant all privileges on. To 'root'@'%' identified by' abc123' with grant option; # sets permissions to achieve remote login

What do you think of the specific steps of using the source package to install the MySQL database? what do you think of this article? If you want to know more about it, you can continue to follow our industry information section.

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