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

Centos7 Editor installs mysql (mysql-5.7)

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

Share

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

The necessity of database: the use of database can store data efficiently and clearly, so that people can manage data more quickly and conveniently. There are three characteristics of the database: it can store a large amount of data information structurally, which is convenient for users to retrieve and access effectively. It can effectively maintain the consistency and integrity of data information and reduce data redundancy. It can meet the sharing and security requirements of the application. Experimental deployment of Software package needed for ip address 192.168.92.128 of Centos7 system in Experimental Environment

1. Install the environment package

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

2.MySQL5.7 needs the boost library for installation. Unpack the two packages mysql-5.7.17.tar.gz and boost_1_59_0.tar.gz that I provided at the beginning of the installation.

3. Create a mysql user

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

4. Configuration file

Cd / opt/mysql-5.7.17 # enter cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # specify mysql installation directory-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ # connection file location-DSYSCONFDIR=/etc\ # specify configuration file directory-DSYSTEMD_PID_DIR=/usr/local/mysql\ # process file directory-DDEFAULT _ CHARSET=utf8\ # specify the default character set encoding-DDEFAULT_COLLATION=utf8_general_ci\ # specify the default character set checking rules-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 enable the system to support mysql database 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 will remain

5. It takes a long time to compile and install, if the experiment done by the virtual machine can increase the processor.

Make & & make install

6. Modify the master group of the database.

Chown-R mysql:mysql / usr/local/mysql/

7. Modify the configuration file to add the following files

Vim / etc/ my.cnf [client] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.socks [mysql] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.socks [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 modeworthy NORICTICTRANSUBSTITIONCONTRICTION codes NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTESchown mysql:mysql / etc/my.cnf

8. Modify permissions for the configuration file

Chown mysql:mysql / etc/my.cnf

9. Set environment variabl

Echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profileecho' export PATH' > > / etc/profilesource / etc/profile # to make the write effective

10. Initialize the database

Cd / usr/local/mysql/bin/mysqld\-- initialize-insecure\ # generate the initialization password (mysql5.7) and actually generate an empty password-- user=mysql\ # specify the administrative user-- basedir=/usr/local/mysql\ # specify the working directory-- datadir=/usr/local/mysql/data # specify the database file directory

11. Add system services

Cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/ systemctl daemon-reload # restart daemon service systemctl start mysqld # start mysql service netstat-anpt | grep 3306 # View port systemctl enable mysqld # Boot self-start

twelve。 Modify database password

Mysqladmin-u root-p password "abc123" #-u specify root account setting password as abc123 login Mysql database

13. Log in with a password

Mysql-u root-p enter password abc123

At this point, your Mysql database is installed.

14. If you want to log in remotely,

Grant all privileges on *. * to 'root'@'%' identified by' abc123' with grant option; # / the first "*" represents all databases, the second "*" represents all tables, gives root permission "%" to represent all server terminals, and can be set to IP address password "abc123"

15. Turn off the firewall

Systemctl stop firewalld.servicesetenforce 0

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