One, add users and Groups
1. Enter Root:
Su
2. Add a group:
Groupadd MySQL
3. Add Users:
Useradd-r-G mysql-s/bin/false MySQL
Second, installation
1. First download the latest version of MySQL 5.7.14 on the MySQL website, go to http://dev.mysql.com/downloads/mysql/, select generic Linux under source code.
2. Unzip
Tar zxvf mysql-5.7.20.tar.gz
3. The tools required to install MySQL:
(1) CMake, a cross-platform installation (compilation) tool;
(2) gcc-c++, C + + compiler;
(3) Boost Library, C + + language standard library extension library ( there is likely to be a pit );
(4) Perl, a programming preamble;
(5) Bison, a parser generator;
(6) Git, version control tools;
(7) Curses, Graph function library.
Yum install cmake gcc-c++ perl-data-dumper bison git ncurses-devel
4. Enter the extracted mysql-5.7.20 directory, compile the source code and generate the makefile.
(1) If your system has the BOOST-1.59 library installed and the environment variable is set, then execute:
CMake.
(2) If your system has a boost-1.59 library installed, then execute:
CMake. -dwith_boost=path of BOOST
(3 If the system prompts could not find Curses (missing:curses_library Curses_include_path), stating that the value of these two parameters CMake is incorrect, then you add two parameters on the above basis:
-dcurses_library=/usr/lib/libncurses.so-dcurses_include_path=/usr/include
5. Compiling:
Make
6. Installation:
Make install
MySQL will be installed in the/usr/local/mysql directory.
7. Enter the installation directory:
Cd/usr/local/mysql
8. Create the Data directory:
MKDIR-M 777 Data
9. Create and configure the MySQL configuration file:
Vi/etc/my.cnf
After entering the editor, modify the following lines ( note the # number is removed ):
Basedir =/usr/local/mysqldatadir =/usr/local/mysql/datasocket =/usr/local/mysql/tmp/mysql.sock #tmp目录需要手工建立, Note the permission is Mysqlport = 3306 NOTE: The socket parameter of [Client][mysqld][mysqld_safe] must be the same, otherwise the first login may fail [[email protected] mysql]# Bin/mysql- Uroot ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/usr/local/mysql/tmp/mysql.sock ' (2)
10. Permission settings:
Chown-r Mysql.mysql.
11. Initialize the database:
Bin/mysqld--initialize--user=mysql
After executing this sentence, MySQL assigns an initial password, which has to be backed up.
Continue execution:
Bin/mysql_ssl_rsa_setup
12. Start MySQL:
Bin/mysqld_safe--user=mysql & or/usr/local/mysql/support-files/mysql.server start or cp/usr/local/mysql/ Support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/mysqldchkconfig--add mysqld can use service mysqld Start | Restart | Status | Status management can also use Systemctl start | Restart | Status | Status Mysqld.service
13. Log in to MySQL:
Bin/mysql-u root-p #必须使用上面初始化产生的临时密码登录 If you forget to re-initialize
14. Change Password:
ALTER USER ' root ' @ ' localhost ' identified by ' new_password ';
15. Telnet Permission:
GRANT all privileges on * * to [email protected] '% ' identified by ' passwd2017 '; FLUSH privileges;
This article is from the "Night" blog, please be sure to keep this source http://liuqun.blog.51cto.com/3544993/1983831
CentOS 7 Source code compilation install MySQL 5.7.20