mysql using yum install and compile and install

1. Download source yum
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
or
wget ' https://dev.mysql.com/get/mysql57-community- el7-11.noarch.rpm-Release '
2. install mysql source
yum localinstall mysql57-Community Community-Release-el7-8.noarch.rpm
3. Check whether the installation is successful mysql source
yum repolist Enabled |. "mysql grep . -community "
4. install MySQL
yum the install MySQL -Y-Community-Server
5. The fire wall close
systemctl STOP firewalld
the setenforce 0
5. The open MySQL
systemctl Start mysqld
++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
capacity to see the state
systemctl status mysqld
Start mysql, you know in centos7, none of the service order, are using systemctl command. Note that the start time is the start mysqld instead of mysql.
See what version of MySQL:
yum repolist All | grep MySQL

Started

Reference links
https://www.cnblogs.com/caoxb/p/9405323.html
https://www.jianshu.com/p/531cc35b15e7

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++
1. Download the installation package
CD / usr / local / the src
wget https://dev.mysql.com/get/Downloads/MySQL -5.7 / MySQL-5.7.20.tar.gz
2. Download Boost
wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
3. download dependencies
yum install - Bison Bison CMake devel-Y-libaio devel-GCC GCC C ++ Git the ncurses-devel
4. decompression MySQL
the tar-5.7.20.tar.gz -zxvf MySQL
will boost compressed to move MySQL
Music Videos boost_1_65_1.tar.gz MySQL-5.7. 20
the original files into the directory mysql, configure a new build directory, the directory into the
CD-mysql 5.7.20
mkdir configure
CD configure
6. the compiler
CMake .. -DBUILD_CONFIG = mysql_release \
-DINSTALL_LAYOUT STANDALONE = \
= RelWithDebInfo -DCMAKE_BUILD_TYPE \
-DENABLE_DTRACE = OFF \
-DWITH_EMBEDDED_SERVER = OFF \
-DWITH_INNODB_MEMCACHED the ON = \
-DWITH_SSL the Bundled = \
-DWITH_ZLIB = System \
-DWITH_PAM the ON = \
-DCMAKE_INSTALL_PREFIX = / var / MySQL / \
-DINSTALL_PLUGINDIR = "/ var / MySQL / lib / plugin "\
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EDITLINE the Bundled = \
-DFEATURE_SET = Community Community \
-DCOMPILATION_COMMENT =" MySQL Server (the GPL) "\
-DWITH_DEBUG = OFF \
-DWITH_BOOST = ..
if compilation errors, delete CMakeCache. After txt, and then recompile
rm -rf CMakeCache.txt
If the following prompt to indicate success generated compiler environment:
- Configuring DONE
- Generating DONE
7.make
successfully compiled
[100%] Building CXX Object SQL / CMakeFiles / udf_example.dir / udf_example.cc.o
Linking CXX Module1 Shared udf_example.so
[100%] Built target udf_example
[100%] Built target my_safe_process
8.make the install
9. The user add mysql
-s the useradd / sbin / nologin MySQL
10. The new log database folder and the folder, and the user to change the MySQL
mkdir / mysql_data
mkdir / var / MySQL / log
chown -R & lt MySQL: MySQL / mysql_data /
chown -R & lt MySQL: MySQL / var / mysql / log
create a file into / var / mysql / log to create a
touch error.log
assign permissions subdirectories and files
chmod -R 777 / var / mysql / log
11. modify the configuration file
vim /etc/my.cnf
will [ mysqld] Replaces the contents:
[mysqld]
Port = 3306
DATADIR = / mysql_data
log_error action = / var / MySQL / log / the error.log
basedir = / var / mysql /
Note: my.cnf file has the following configuration
socket = / var / lib / mysql / mysql.sock
need to manually establish mysql.sock, write and execute permissions assigned
the chmod 777 -R & lt mysql.sock
12 is. database initialization
/ var / mysql / bin / mysqld --initialize --user = mysql
see if the data file generated:

[root@localhost configure]# ll /mysql_data/
总用量 110620
-rw-r-----. 1 mysql mysql       56 10月  2 19:44 auto.cnf
-rw-r-----. 1 mysql mysql      419 10月  2 19:44 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 10月  2 19:44 ibdata1
-rw-r-----. 1 mysql mysql 50331648 10月  2 19:44 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 10月  2 19:44 ib_logfile1
drwxr-x---. 2 mysql mysql     4096 10月  2 19:44 mysql
drwxr-x---. 2 mysql mysql     4096 10月  2 19:44 performance_schema
drwxr-x---. 2 mysql mysql    12288 10月  2 19:44 sys

Check whether the log file is generated:

[root@localhost mysql]# ll /var/mysql/log/
总用量 4
-rw-r-----. 1 mysql mysql 802 10月  2 19:47 error.log

13.
1. Copy the boot files from the template file:

cp /var/mysql/support-files/mysql.server /etc/init.d/mysqld

  1. Modify the startup file:

vim /etc/init.d/mysql
find the following two lines:

basedir=
datadir=

change into:

basedir=/var/mysql/
datadir=/mysql_data
  1. Start mysql:

    [root @ localhost MySQL] # /etc/init.d/mysqld Start
    Starting MySQL. SUCCESS!
    +++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
    download source installation package mysql
    wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
    mysql installation source
    yum localinstall mysql57-community-release -el7-8.noarch.rpm
    check whether the installation was successful mysql source
    yum repolist Enabled | grep. "mysql -community. "

Install MySQL
yum install MySQL-Server Community Community-
start the MySQL service
systemctl start mysqld
view MySQL startup state
systemctl status mysqld

Boot
systemctl enable mysqld
systemctl daemon-reload

Guess you like

Origin blog.51cto.com/14375805/2442982