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

Manual compilation of mysql5.7 database by centos7 (with source code package)

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

Share

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

Introduction to mysql:

MySQL is a relational database management system developed by MySQL AB Company of Sweden and currently belongs to Oracle Company.

MySQL is an associated database management system that stores data in different tables instead of all data in a large warehouse, which increases speed and flexibility.

Experimental environment: centos7 one, NAT mode virtual machine mount compiled directory size can not be less than 8G so, it is recommended to add a disk, mount to the local compilation and installation link: https://pan.baidu.com/s/1XFej_DoR3bXkCiTxFqhVOQ password: amv1 boost source package address link: https://pan.baidu.com/s/1L4Saf17boqWTAqmm9mKWrw password: dhjkmysql5.7 source package address Note: the storage space required for compilation is not less than 7G It is recommended to add disk mount compilation to the virtual machine

1. Install the compilation environment package as follows:

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

2. Create mysql users

Useradd-s / sbin/nologin mysql

3. Mount the host folder and extract the package.

Mount.cifs / / 192.168.60.1/linuxbage / root/abc

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

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

4. Change the name of the boost directory to make it easy to compile the abbreviation cd / usr/local/ to the decompressed directory mv boost_1_59_0 boost / rename boost

5. Go to the directory where mysql is decompressed.

Cd / root/abc

The compilation parameters are as follows

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\

-DSYSCONFDIR=/etc\

-DSYSTEMD_PID_DIR=/usr/local/mysql\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_ARCHIVE_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\

-DMYSQL_DATADIR=/usr/local/mysql/data\

-DWITH_BOOST=/usr/local/boost\

-DWITH_SYSTEMD=1

6. Make & & make install7, chown-R mysql.mysql / usr/local/mysql/ change mysql main genus group

8. Change the configuration file

Vim / etc/my.cnf

Configure for different areas

Client] client

Port = 3306 3306 port

Default-character-set=utf8 character set

Socket = / usr/local/mysql/mysql.sock client connection server connection directory

[mysql] server

Port = 3306 3306 port

Default-character-set=utf8 character set

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

[mysqld] set for the service itself

User = mysql administrative user is mysql

Basedir = / usr/local/mysql working directory path

Datadir = / usr/local/mysql/data database file path, which is automatically generated

Port = 3306 port 3306

Character_set_server=utf8 character set

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

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

Server-id = 1 server 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

9. Modify the master group of my.cnf and add environment variables

10. Initialize the database

Cd / usr/local/mysql/

Bin/mysqld\

-- initialize-insecure\

-- user=mysql\

-- basedir=/usr/local/mysql\

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

11. Copy startup script

Cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/

12. Start mysql

Systemctl daemon-reload

Systemctl start mysqld

Netstat-anpt | grep 3306

Systemctl enable mysqld

13. Set the login password

Mysqladmin-u root-p password "abc123"

14. Log in to mysql and view the database

15. Set permissions to achieve remote login

Grant all privileges on. To 'root'@'%' identified by' abc123' with grant option

End~

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