Recommended reading:
Mysql5.7 Forget the root password and mysql5.7 modify the root password method
MAC Installation and Uninstall Mysql5.7.11 method
The system is cenos6.7 64-bit, the default mysql5.7.11 download to/USR/LOCAL/SRC, the installation directory in the/app/local/mysql directory, MySQL data placement directory/app/local/data. MySQL from 5.1 After the CMake way to compile the installation, so you have to compile the installation CMake tool, you can also use the Yum way to install CMake. Compiling the installation from mysql5.7 requires boost library support, so download the boost library as well
#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 new MySQL user.
#groupadd MySQL
#useradd-g MySQL mysql-s/bin/false
Create the appropriate 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. /
Extract the Boost library into the/usr/local/boost directory
#tar zxvf boost_1_59_0.tar.gz
#cd boost_1_59_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/-dmysql_datadir=/app/local/data-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dmysql_tcp_ Port=3306-dmysql_user=mysql-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_archive_ storage_engine=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--init Ialize--user=mysql--basedir=/app/local/mysql/--datadir=/app/local/data/#初始化mysql and generates a random password #mv/etc/my.cnf/etc/ my.cnfbak# first 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 in with the random password you just generated
If we can't, we'll have password in the my.cnf.
Reset root Password after login
mysql> SET PASSWORD for ' root ' @localhost = PASSWORD (' 123456 ');
Query OK, 0 rows affected, 1 Warning (0.00 sec)
It's okay.
About the small set to introduce the MySql5.7.11 compile installation and modify the root password method to introduce so many people, I hope to help!