surroundings:
ubuntu18.04.2
mysql5.7.21
# Create mysql is a group groupadd mysql useradd - G mysql mysql # view is a set of tail / etc / passwd # Create mysql frequently used folders in the / usr / Locle mkdir mysql mkdir the Boost mkdir - the p- / the Data / mysql # affiliated group chown - R mysql : MySQL / Data / MySQL chown - R & lt MySQL: MySQL MySQL # decompression Boost the tar - xvf boost_1_59_0.tar.gz Music Videos * / usr / local/boost #下载依赖包 apt-get install make cmake gcc g++ bison libncurses5-dev build-essential #解压mysql tar -xvf mysql-5.7.21.tar.gz cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -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 # - DCMAKE_INSTALL_PREFIX installed software catalog # - DMYSQL_DATADIR data files stored in the path # - DSYSCONFDIR configuration file path (the my.cnf) # - DENABLED_LOCAL_INFILE = . 1 using localmysql Client Configuration # - DWITH_PARTITION_STORAGE_ENGINE that the support part table mysql # - DEXTRA_CHARSETS installation supported character set # - DDEFAULT_CHARSET the default character set used here configured as UTF - 8 # - DDEFAULT_COLLATION connection character set # - DWITH_SSL open ssl mysql using the make && the make install #ysql execute commands added to the system environment variables echo "Export the PATH = $ the PATH: / usr / local / MySQL / bin" >> / etc / Profile Source / etc / Profile # Set my.cnf vi / etc / my.cnf [ mysqld ] DATADIR = / Data / MySQL Socket = / usr / local / MySQL / mysql.sock PID - File = / Usr / local / MySQL / mysql.pid log_error action = / Data / MySQL / MySQL - . Error log # installation directory initialization CD / usr / local / MySQL / bin . / Mysqld - the initialize --user = MySQL --basedir = / usr / local / mysql / --datadir = / the Data / mysql / # service mysql start cd / usr / local / mysql / Support - Files . /Start mysql.server # initialization is complete Please note temporary password (the last row) print information will prompt the root user; # Change Password the SET password for root @localhost = password ( ' 123456 ' );
# mysql so far has been completely installed successfully compiled
mysql -uroot -p