MySQL Database with source installation
[[email protected] ~]# wget -c http://mirrors.sohu.com/mysql/mysql-5.7/ mysql-5.7.17.tar.gz[[email protected] ~]# tar -zxf mysql-5.7.17.tar.gz[[email Protected] ~]# cd mysql-5.7.17[[email protected] mysql-5.7.17]# yum install cmake ncurses-devel -y[[email protected] mysql-5.7.17]# cmake -dcmake_ Install_prefix=/usr/local/mysql -dmysql_datadir=/usr/local/mysql/data -dsysconfdir=/etc -dwith_ Myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_ readline=1 -dmysql_unix_addr=/usr/local/mysql/mysql.sock \ #指定套间字路径-dmysql_tcp_port=3306 -denabled_local_infile=1 -dwith_partition_storage_engine=1 -dextra_charsets=all -ddefault_charset=utf8 \ # Set the character set-ddefault_collation=utf8_general_ci \ #设置字符校验集-ddownload_boost=1 -dwith_boost=/usr/local/boost #指定Boost扩展源码路径
---------------------------------------------------------------
CMake Warning:
Manually-specified variables were not used by the project:
With_memory_storage_engine
With_readline
--Build files has been written to:/root/mysql-5.7.17
---------------------------------------------------------------
The result above shows that the precompilation was successful!
[[email protected] mysql-5.7.17]# make-j grep ' processor '/proc/cpuinfo | wc-l [[email protected] mysql-5.7.17]# make-j grep ' processor '/proc/cpuinfo | Wc-l Install
Check if the system already has a MySQL user and if not, create
[Email protected] mysql-5.7.17]# CAT/ETC/PASSWD | grep mysql[[email protected] mysql-5.7.17]# Cat/etc/group | grep MySQL
Creating a MySQL user (but not using the MySQL account login system)
[[email protected] mysql-5.7.17]# groupadd mysql[[email protected] mysql-5.7.17]# useradd-g mysql-s/sbin/nologin MySQL
Modify Permissions
[Email protected] mysql-5.7.17]# chown-r mysql:mysql/usr/local/mysql
[[email protected] mysql-5.7.17]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf[[email protected] mysql-5.7.17]# vim /etc/my.cnf###################[ mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/usr/local/mysql/mysql.sockuser=mysql# Innodb_force_recovery=6# disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-bin=mysql-binserver-id = 1auto_increment_ offset=1auto_increment_increment=2# settings user and group are ignored when systemd is used.# if you need to run mysqld under A different user or group,# customize your systemd unit file for mariadb according to the# instructions in http:// Fedoraproject.org/wiki/systemd[mysqld_safe]log-error=/usr/local/mysql/mysqld.logpid-file=/usr/local/mysql/mysqld.pid## include all files From the config directory#!includedir /etc/my.cnf.d
[Email protected] mysql-5.7.17]# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld[[email protected ] mysql-5.7.17]# vim/etc/init.d/mysqld#### #添加安装目录及数据目录basedir =/usr/local/mysqldatadir=/usr/local/mysql/data
[Email protected] mysql-5.7.17]# chkconfig--add mysqld[[email protected] mysql-5.7.17]# chkconfig--level + mysqld on
Enter/etc/profile to set environment variables
[Email protected] mysql-5.7.17]# vim/etc/profileexport path=/usr/local/mysql/bin: $PATH #在末尾添加 [[Email PR Otected] mysql-5.7.17]# Source/etc/profile
Enter the installation path, execute the initialization configuration script, create the system's own database and table
#mysql5.7 before the version initialization configuration Table command:
#script/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data--basedir=/usr/local/mysql/
#mysql5.7 has been abandoned, and there is no script directory, you can use the following
#[[email protected] mysql-5.7.17]#/usr/local/mysql/bin/mysqld--initialize--user=mysql--datadir=/usr/local/mysql/ Data--basedir=/usr/local/mysql/
The resulting initial password is located at:
Method One:
[[email protected] mysql-5.7.17]# grep ' temporary password '/var/log/mysqld.log 2016-07-08t02:25:46.311098z 1 [Note] A te Mporary password is generated for [email protected]: Mtpqf0/on5zo
That is, the initial password is Mtpqf0/on5zo (the password is generated randomly, each machine produces a different one OH)
Method Two:
[[email protected] mysql-5.7.17]# cat/root/.mysql_secret# the random password set for the root Userat Fri Jan 10 20:00:34 (local time): ajqzsa2m
The ajqzsa2m here is the generated root random password.
Next, start the database and reset the root password
[[email protected] mysql-5.7.17]#/etc/init.d/mysqld start
[[email protected] mysql-5.7.17]# mysql-uroot-penter Password: # Enter just the random password link database m Ysql> ALTER USER ' root ' @ ' localhost ' identified by ' new password ';
This article is from the "Mq_douer" blog, make sure to keep this source http://douer.blog.51cto.com/6107588/1933366
MySQL Database Source installation