LNMP compilation and installation-install msyql-graphic explanation, lnmpmsyql
LNMP compilation and installation-msyql installation-graphic explanation
1. Preface
This installation uses the source code. The main resource package is downloaded from the official website, and the secondary dependency is installed using yum. This article only involves mysql installation, msyql remote logon, and mysql configuration is not involved. This tutorial is purely installed and does not involve any important knowledge. It is suitable for all ages.
2. Installation Steps
2.1 Download boost (only download without installation)
Wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
2.2 decompress bosot
Tar zxvf boost_000059_0.tar.gz
2.3. Mobile boost (can be omitted)
Mv boost_000059_0/usr/local/boost (the directory location needs to be recorded, and mysql needs to be installed)
2.4 download mysql
Wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz
2.5 decompress msyql
Tar-zxvf mysql-5.7.18.tar.gz
2.6 install Dependencies
Yum install gcc-c ++ ncurses-devel perl-Data-Dumper
3. Preparations before installation
3.1 create a user
Useradd-M-s/sbin/nologin mysql
3.2 Create a directory
Mkdir-pv/usr/local/mysql/mydata
Mkdir-pv/usr/local/mysql/conf
3.3 modify directory owner
Chown-R mysql/usr/local/mysql
3.4 delete my. cnf
Rm-rf/etc/my. cnf (my. cnf must be deleted, which is often unsuccessful if not deleted)
4. Start Installation
4.1 generate makefile
Cd mysql-5.7.19
Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \ (installation directory)
-DMYSQL_DATADIR =/usr/local/mysql/mydata \ (storage directory)
-DSYSCONFDIR =/usr/local/mysql/conf \ (configuration file directory)
-DMYSQL_USER = mysql \ (User)
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \ (UNIX socket file)
-DMYSQL_TCP_PORT = 3306 \
-DENABLED_LOCAL_INFILE = 1 \
-DENABLE_DOWNLOADS = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_DEBUG = 0 \
-DMYSQL_MAINTAINER_MODE = 0 \
-DWITH_SSL: STRING = bundled \
-DWITH_ZLIB: STRING = bundled \
-DDOWNLOAD_BOOST = 1 \
-DWITH_BOOST =/usr/local/boost (boost directory)
Make complete
4.2 compile and install
Make & make install
Installation Complete
4.3 Initialization
/Usr/local/mysql/bin/mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/mydata (random password Initialization)
/Usr/local/mysql/bin/mysqld -- initialize-insecure -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data (none password initialization)
Password-less Initialization
4.4 start a mysql instance
After the startup is successful, you need to restart the console to log on.
/Usr/local/mysql/bin/mysql-u root-p
5. Create a remote Logon account
5.1 create a Logon account
Grant all privileges on *. * TO 'mysql _ user (account) '@' % (host) 'identified by 'mysql _ user (password)' with grant option;
5.2 open port 330
Firewall-cmd -- zone = public -- add-port = 3306/tcp -- permanent
5.3 restart the Firewall
Systemctl restart firewalld. service
5.4 remote logon Test
Omitted
6. Modify the environment variable File
Vi/etc/profile +;
Add a row at the bottom
Refresh the environment variable File
Source/etc/profile
Logon again
7. Enable auto-Start Settings
7.1 copy the driver File
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
7.2 modify File Permissions
Chmod + x/etc/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig mysqld on
7.3 restart Test
Omitted