sudo apt-get install build-essential libncurses5-dev cmake
sudo groupadd MySQL
sudo useradd-g mysql MySQL
sudo mkdir-p/data/mysql/
sudo mkdir-p/data/mysql/data/
Wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7 ...
TAR-ZXF mysql-5.7.11.tar.gz
SH build/autorun.sh
# MySQL started with the 5.5 version, the compiler configuration through./configure has been canceled, replaced by the CMake tool, the following is only used to contrast write cmake, and can not perform
./configure--prefix=/usr/local/mysql/--localstatedir=/data/mysql/data--enable-assembler--without-isam- With-unix-socket-path=/data/mysql/data--enable-thread-safe-client--with-client-ldflags=-all-static-- With-mysqld-ldflags=-all-static--with-plugins=partition,innobase--with-charset=utf8--with-collation=utf8_ General_ci--WITH-EXTRA-CHARSETS=UTF8,GBK--with-big-tables--without-debug
# to be like Apt-get installation, MySQL placed in/var/lib/mysql/,sock on/var/run/mysqld/
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/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=/var/run/mysql/mysql.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dextra_charsets=utf8,gbk-ddefault_ Charset=utf8-ddefault_collation=utf8_general_ci-dwith_partition_storage_engine=1-dwith_embedded_server=0
mysql5.7 needs the latest version of Boost, if prompted:
--Could not find (the correct version of) boost.
--MySQL currently requires BOOST_1_59_0
Download boost_1_59_0.tar.gz to http://www.boost.org
TAR-ZXVF boost_1_59_0.tar.gz
CD Boost_1_59_0
# Compile engine to build boost
./bootstrap.sh
# Start compiling boost program, it takes more than 10 minutes, there is no progress bar, not like make, the egg is dead, the completion of the installation on behalf of the successful.
./bjam--prefix==./prefix/install
# Install Boost
./B2 Install
# back to MySQL source directory
Cd.. /mysql-5.7.11
# Turn on 4 threads to compile
Make-j4
# installation
Make install
If an error occurs at 53%:
MAKE[2]: * * * [storage/perfschema/unittest/pfs_connect_attr-t] Error 1
MAKE[1]: * * * [Storage/perfschema/unittest/cmakefiles/pfs_connect_attr-t.dir/all] Error 2
Plus parameter-dwith_embedded_server=0
The reason is that it was compiled by default in embedded mode: https://bugs.launchpad.net/percona-server/+bug/798050
The errors are in embedded which are not supported in Percona Server. Please try Building With-dwith_embedded_server=off
Changed in Percona-server:
Status:new→invalid
# Modify MySQL installation directory and data directory permissions
sudo chown-r mysql:mysql/usr/local/mysql
sudo chown-r mysql:mysql/data/mysql/
Cd/usr/local/mysql
sudo cp support-files/my-default.cnf/etc/my.cnf
sudo cp support-files/mysql.server/etc/init.d/mysqld
# Generate Database Data
sudo/usr/local/mysql/bin/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/usr/local/mysql--datadir=/data/ Mysql/data--user=mysql
# Configure environment variables, otherwise MySQL client commands are not available
Vim/etc/profile, adding at end of file
Path=/usr/local/mysql/bin: $PATH
Export PATH
Source/etc/profile
# Modify Password: MySQL5.7 after installation, the first time to start, will be in the root directory to produce a random password, file name is
. Mysql_secret
Cat/root/.mysql_secret
Log in with the resulting random password, and then modify the password with the following command
SET PASSWORD = PASSWORD (' new PASSWORD ');
No need for flush privileges;
Problem:
1. [Warning] Insecure configuration for--secure-file-priv:current value does not restrict location of generated files. Consider setting it to a valid, Non-empty path.
Resolution: 283 lines, Mysqld_safe--secure-file-priv=null
2. [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (the documentation for more details).
Solution:/ETC/MY.CNF Plus
Explicit_defaults_for_timestamp = 1
3, Skip-name-resolve is to disable DNS resolution, after the open can only use IP, otherwise appear the following prompts
[Warning] ' User ' entry ' root@localhost ' ignored in--skip-name-resolve mode.
[Warning] ' User ' entry ' mysql.sys@localhost ' ignored in--skip-name-resolve mode.
[Warning] ' DB ' entry ' sys mysql.sys@localhost ' ignored in--skip-name-resolve mode.
[Warning] ' Proxies_priv ' entry ' @ root@localhost ' ignored in--skip-name-resolve mode.
[Warning] ' Tables_priv ' entry ' sys_config mysql.sys@localhost ' ignored in--skip-name-resolve mode.
WORKAROUND: Delete Non-IP logged-on users
mysql> use MySQL;
mysql> Delete from user where host= ' localhost.localdomain ';