First, ready to work 1.1 uninstall the system comes with MySQL
Check to see if the system comes with MySQL, uninstall it if any, there are two kinds of yum, RPM, here to uninstall via Yum
grep mysql // View system comes with MySQLyum -y remove mysql-* // uninstall MySQL rpm-e--nodeps mysql-5.1. 3// uninstall MySQL
1.2 Uninstalling the system comes with boost and installs Boost_1_59_0
MySQL 5.7 relies on boost_1_59_0 or later to see if the system is self-contained, and if so, uninstalls it.
grep Boost // View system comes with boostyum -y remove boost-* // offload boost rpm-e--nodeps boost-filesystem-1.41. 0-one. El6_1. 2 // Uninstall Boost
Install BOOST_1_59_0, CMake compile-time plus-DWITH_BOOST=/usr/local/boost
tar -zxvf boost_1_59_0. Tar . GZ MV Boost_1_59_0/usr/local/boost
1.3 Installing dependent Packages
Yum Install GCC GCC Perl
1.4 Installing CMake
tar -zxvf cmake-3.4. 1. Tar . gz. /Configuremake doinstall
1.5 download MySQL source package mysql-5.7.10.tar.gz
Download via wget
wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz
Download the required source package in Windows and upload it via the File Transfer tool Rzsz
yum install lrzsz //安装rzszrz //上传
1.6 Creating user groups MySQL and user MySQL
Check if the system already has a MySQL user and if not, create
Cat grep mysql // See if there is a MySQL user group cat /etc/passwdgrep MySQL // see if MySQL user groupadd MySQL is present // Create user group useradd-r-g MySQL MySQL // Create user
1.7 Create MySQL directory and database directory, and give users MySQL permissions
Create MySQL directory and database directory
mkdir /usr/local/mysql // create MySQL directory mkdir /usr/local/mysql/data // Create database directory mkdir /usr/local/mysql/log // Create log file directory chown -R Mysql:mysql/usr/local/mysql // give permission
Second, compile, install, configure mysql2.1 compile, install MySQL
Compile with some parameters such as installation root, database directory, encoding, port number, default storage engine, etc.
When compiling, remember to bring-DWITH_BOOST=/usr/local/boost
Tar-ZXVF mysql-5.7.Ten.Tar. GZCD MySQL-5.7.TenCMake.-dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/usr/local/mysql/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 -denable_downloads=1 -ddownload_boost=1 -dwith_boost=/usr/local/Boost Make&& Make Install
Configuration options reference Address, [http://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html][1]
2.2 compilation error, before recompiling to delete the compilation failed file
When recompiling, you need to clear the old object file and cache information
Make Clean RM -F CMakeCache.txt
2.3 Configuring MY.CNF
MY.CNF files can be based on their own needs to choose the right configuration, there are many online, you can refer to, here is not detailed description. Remember to put the MY.CNF in/etc directory
MV my.cnf/etc/my.cnf
2.4 Initializing the system data sheet
Starting with mysql5.7, initializing the system table no longer uses mysql_install_db the tool, mysqld --initialize-insecure --user=mysql which --initialize means that a secure password is generated by default, indicating that --initialize-insecure no password is generated and that the password is empty
cd/usr/local/mysqlbin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/usr /local/mysql/data
2.5 Adding environment variables, registering as System services
Add environment variables, add parameters in PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
vim/root/. Bash_profilepath= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql//root/.bash _profile
Registering as a system service
CP support-files/mysql.server/etc/init.d/mysqldchkconfig mysqld onservice mysqld start/stop/ Restart/status
First Login setting password
- Set a password directly using mysqladmin
123456 // Login Time
- or after logging in to MySQL with a blank password, perform the following password change command on the MySQL client
' Root '@'localhost' = PASSWORD ('123456'); // after login
View process
3306pkill mysqld
转自
mysql5.7.10 Source compilation installation Record (centos6.4)-hpy1165331898 's Column-Blog channel-csdn.net
http://blog.csdn.net/hpy1165331898/article/details/50557022
mysql5.7.10 Source compilation installation record (centos6.4) "Turn"