MySql5.7.11 Compilation installation and modification of root password

  • 2020-12-22 17:49:11
  • OfStack

Recommended reading:

Mysql5.7 forget root password and es5EN5.7 how to change root password

Mac Methods of installing and uninstalling Mysql5.7.11

The system is cenos6.7 64-bit, the default ES14en5.7.11 is downloaded to /usr/local/src, the installation directory is under /app/local/mysql, and the mysql data is placed under /app/local/data. mysql is compiled and installed in cmake mode after 5.1, so the cmake tool should be compiled and installed first, or yum mode can be used to install cmake. Compiling and installing from mysql5.7 on requires support for the boost library, 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 there is no 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 ../

Unzip the boost library to 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 --initialize --user=mysql --basedir=/app/local/mysql/ --datadir=/app/local/data/# Initialize the mysql  And generate 1 Random password 
#mv /etc/my.cnf /etc/my.cnfbak# First back up the generated one 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 not, configure password in ES70en.cnf

Reset the root password after logging in


mysql> SET PASSWORD FOR 'root'@localhost = PASSWORD ( '123456' ); 
Query OK, 0 rows affected, 1 warning (0.00 sec)


It is ok

On this site to introduce the es87EN5.7.11 compilation, installation and modification of root password for you to introduce so much, I hope to help you!


Related articles: