In CentOS7 compile install mysql-5.7.20

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_34017326/article/details/78955494

1 dependent files and software

cmake

mysql-5.7.20

boost_1_59_0.tar.gz

ncurses
ncurses-devel

bison

gcc-c++
gcc

2 compilation

2.1 Create a subdirectory for storing intermediate files produced by the compiler. / root / mysql is my boost_1_59_0.tar.gz storage location
mkdir && cd bld bld
cmake -DDOWNLOAD_BOOST = 1 -DWITH_BOOST = / root / mysql ..

2.2 compile
make

3 Installation

3.1 make install
command to the default location to install mysql / usr / local / mysql, if you want to another location may be used to install DESTDIR parameters, for example:
the make the install DESTDIR = "/ opt / mysql." (The best choice for the default location, change the position there will be other problems arise, there is no solving)

3.2 useradd mysql
create a mysql is used to start mysql, mysql move to limit authority, to prevent access to system files mysql

3.3 bin / mysqld --initialize --user = mysql
initialization is performed after successful initialization will generate an initial password, a user first visits mysql services need to modify the initial password

3.4 bin / mysql_ssl_rsa_setup
generate ssl certificates, provided the security mysql

3.5 bin / mysqld_safe --user = mysql &
running in the background service mysql

3.6 cp support-files / mysql.server /etc/init.d/mysql.server
optional step, the purpose of this step is to mysql service added to the system services, which can use the service command to view service status

3.7 bin/mysql -u root -p
Log mysql, where the password is generated initial password step 3.3, after a successful login to use the ALTER USER statement to modify the initial password, or can not carry out any operation. I use the following command to modify the password is 123456
alter user 'root'@'localhost' identified by '123456';:

4 pack

make package

5 attached

boost_1_59_0.tar.gz
Click on the link to open the  extraction code twmc

Guess you like

Origin blog.csdn.net/qq_34017326/article/details/78955494