watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk= One 、mysql install 1. Binary installation 2. Source package installation 3.rpm Package installation 1. Source package installation 1) Upload or download source code package [[email protected] ~]# rz mysql-5.6.46.tar.gz 2) Installation dependency Due to different installation environments , Other errors may be reported during the generation process , Just install the corresponding Eni package according to the error prompt .

One 、mysql install

1. Binary installation
2. Source package installation
3.rpm Package installation 

1. Source package installation

1) Upload or download source code package

[[email protected] ~]# rz mysql-5.6.46.tar.gz

2) Installation dependency

Due to different installation environments , Other errors may be reported during the generation process , Just install the corresponding Eni package according to the error prompt .

[[email protected] ~]# yum install -y ncurses-devel libaio-devel gcc gcc-c++ glibc cmake autoconf openssl openssl-devel

3) Unzip the installation package

[[email protected] ~]# tar xf mysql-5.6.46.tar.gz

4) Generate

[[email protected] ~]# cd mysql-5.6.46/
[[email protected] mysql-5.6.46]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.46 \
-DMYSQL_DATADIR=/usr/local/mysql-5.6.46/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.6.46/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=system \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0

5) Compile and install

[[email protected] mysql-5.6.46]# make && make install

6) Make a soft connection

[[email protected] ~]# ln -s /usr/local/mysql-5.6.46 /usr/local/mysql

7) Create user

[[email protected] ~]# useradd mysql -s /sbin/nologin -M

8) Copy configuration files and startup scripts

[[email protected] ~]# cd /usr/local/mysql/support-files/
[[email protected] support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite '/etc/my.cnf'? y
[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld

9) Initialize database

[[email protected] support-files]# cd /usr/local/mysql/scripts/
[[email protected] scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

8) To configure system management mysql

[[email protected] scripts]# vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
[[email protected] scripts]# systemctl daemon-reload
[[email protected] scripts]# systemctl start mysqld

9) Start failure, error report

[[email protected] scripts]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/usr/local/mysql-5.6.46/data/db02.err'.
200709 15:42:14 mysqld_safe Directory '/usr/local/mysql-5.6.46/tmp' for UNIX socket file don't exists.
 ERROR! The server quit without updating PID file (/usr/local/mysql-5.6.46/data/db02.pid).
 
# reason :
1.cmake The procedure specifies socket file location , The actual location doesn't exist
2. Insufficient directory permissions
 
# solve :
[[email protected] scripts]# mkdir /usr/local/mysql-5.6.46/tmp/
[[email protected] scripts]# chown -R mysql.mysql /usr/local/mysql
[[email protected] scripts]# chown -R mysql.mysql /usr/local/mysql-5.6.46/

10) Start database

[[email protected] scripts]# systemctl start mysqld

11) Configure environment variables

[[email protected] scripts]# vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
[[email protected] mysql]# source /etc/profile

12) Confirm start up

[[email protected] scripts]# ps -ef | grep mysql
mysql     12886      1  2 03:10 ?        00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
root      12921  10636  0 03:11 pts/1    00:00:00 grep --color=auto mysql
[[email protected] scripts]# netstat -lntp   
tcp6       0      0 :::3306                 :::*                    LISTEN      12886/mysqld



FBI WARNING

QQ:1402122292 Be original sheldon Others call me Xiaodong