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

Install Mysql5.7 version in Centos7 environment

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

Share

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

Experimental environment: VMware Workstation12 Centos-7-x86_64 system (ip address: 192.168.5.132) (2 GB memory 2 processors) using software: boost_1_59_0, mysql-5.7.17 [Baidu Network disk] (https://pan.baidu.com/s/1sKubgwvM1Ft6_XdkqzzbDQ) experiment begins 1. Install the experimental environment

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

Create a directory file to extract the package to the specified file

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

Tar zxvf boost_1_59_0.tar.gz-C / usr/local/

Cd / usr/local/

Mv boost_1_59_0 boost

Note: Mysql installation requires the corresponding boost version, do not choose the wrong version

two。 Compilation and installation

Useradd-M-s / sbin/nologin mysql / / create user mysql, do not create home directory, do not allow login to the system

Cd / opt/mysql-5.7.17/

Configure cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ / specify the mysql database installation directory-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ / / connection file location-DSYSCONFDIR=/etc\ / / specify the configuration File directory-DSYSTEMD_PID_DIR=/usr/local/mysql\ / / process file directory-DDEFAULT_CHARSET=utf8\ / / specify the character set encoding used by default-DDEFAULT_COLLATION=utf8_general_ci\ / / specify default to Character set proofreading rules used-DWITH_INNOBASE_STORAGE_ENGINE=1\ / Storage engine-DWITH_ARCHIVE_STORAGE_ENGINE=1\ / Storage engine-DWITH_BLACKHOLE_STORAGE_ENGINE=1\ / Storage engine-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\ / / Storage engine-DMYSQL_DATADIR= / usr/local/mysql/data\ / / Database file-DWITH_BOOST=/usr/local/boost\ / / specify the location of the Boost library Mysql5.7 must add this parameter-DWITH_SYSTEMD=1 / / to make the system support Mysql database

Compilation and installation

Make & & make install

Note: if there is an error in the process of CMAKE, when the error is resolved, you need to delete the CMakeCache.txt file in the source directory, and then re-CMAKE, otherwise the error remains the same.

The make process is very time-consuming, so you can consider increasing the number of processors and modify memory if you break along the way.

3. Post-installation configuration file

3.1 modify the database catalog file

Chown-R mysql.mysql / usr/local/mysql/

3.2 modify the configuration file vim / etc/ my.confession [client] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.sock [mysql] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.sock [mysqld] user = mysqlbasedir = / usr/local/mysqldatadir = / usr/local/mysql/dataport = 3306character_set_server=utf8pid-file = / usr/local/mysql/mysqld.pidsocket = / usr/local/mysql/mysql.sockserver-id = 1sqlcards 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 / / modify profile permissions

The file is configured as the following figure, and that's fine.

3.3 the owner of the modified document

Chown mysql:mysql / etc/my.cnf

3.4 set the environment variable echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profileecho' export PATH' > > / etc/profilesource / etc/profile / / to initialize the database > cd / usr/local/mysql/bin/mysqld\-- initialize-insecure\ / / generate the initialization password (empty password) )-- user=mysql\ / / specify administrative user-- basedir=/usr/local/mysql\ / / specify working directory-- datadir=/usr/local/mysql/data / / specify data file directory 4. Add system service > cp usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/systemctl start mysqld / / startup service netstat-anpt | grep 3306 / / verify startup port 5. Access Mysql database 5.1 modify database password mysqladmin-u root-p password "abc123" / /-u specify login user as root, password as abc1235.2 login system mysql-u root-pshow databases; ← (note semicolon) / / view database information

This is the end of this article.

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