Summary of mysql5.7.11 compiling and installing and modifying the root password, mysql5.7.11root
The system is cenos6.7 64-bit. By default, mysql5.7.11 is downloaded to/usr/local/src. The installation directory is in the/app/local/mysql directory, mysql data DIRECTORY/app/local/data. Mysql is compiled and installed in cmake mode after mysql 5.1. Therefore, you must compile and install the cmake tool first, or install cmake in yum mode. Compiling and installation from mysql5.7 requires support from the boost library, so you must also download the boost Library
# Wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.11.tar.gz
# Wget https://cmake.org/files/v3.1/cmake-3.1.3.tar.gz
# Wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
If you do not have a mysql user, create a mysql user.
# Groupadd mysql
# Useradd-g mysql-s/bin/false
Create a directory
# Mkdir-p/app/local/{mysql, data}
# Mkdir/usr/local/boost
Compile and install cmake
# Tar zxvf cmake-3.1.3.tar.gz
# Cd cmake-3.1.3
#./Configure
# Make & make install
# Cd ../
Decompress the boost Library to the/usr/local/boost directory.
# Tar zxvf boost_000059_0.tar.gz
# Cd boost_000059_0/
# Mv./*/usr/local/boost/
# Cd ../
Compile and install mysql5.7.11
# Tar zxvf mysql-5.7.11.tar.gz
# Cd mysql-5.7.11
# Cmake-DCMAKE_INSTALL_PREFIX =/app/local/mysql/-plugin =/app/local/data-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-plugin = 3306-DMYSQL_USER = mysql-plugin = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-runtime = 1-DWITH_BLACKHOLE_STORAGE_ENGINE = 1-DWITH_MEMORY_STORAGE_ENGINE = 1-DDOWNLOAD_BOOST = 1-DWITH_BOOST =/usr/local/boost
# Make & make install
# Cd ../
# Chown-R mysql: mysql/app/local/data/
# Chown-R mysql: mysql/app/local/mysql/
# Cd/app/local/mysql/bin
#./Mysqld -- initialize -- user = mysql -- basedir =/app/local/mysql/-- datadir =/app/local/data/# initialize mysql and generate a random password
# Mv/etc/my. cnf/etc/my. cnfbak # back up the generated my. cnf
# Cp ../support-files/my-default.cnf/etc/my. cnf
# Cp ../support-files/mysql. server/etc/init. d/mysqld
# Chmod 755/etc/init. d/mysqld
# Chkconfig mysqld on
# Service mysqld start
# Mysql-uroot-p
Enter password:
Log On with the generated Random Password
If not, configure password in my. cnf.
Reset the root password after Logon
Mysql> set password for 'root' @ localhost = PASSWORD ('20140901 ');
Query OK, 0 rows affected, 1 warning (0.00 sec)
You can.