2017-12-25
# Configure host name full display vim/etc/BASHRC # Turn on checkwinsize shopt-s Checkwinsize ["$PS 1"="\\s-\\v\\\$"] && ps1="[\[email protected]\h \w]\\$"# Configure host name to be permanently active vim/etc/sysconfig/networknetworking=Yeshostname=mysql-5.7-master# Configuring host names to take effect temporarilyhostnamemysql-5.7-master# Configure hosts to parse vim/etc/hosts127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4::1localhost localhost.localdomain localhost6 localhost6.localdomain610.0.0.156mysql-5.7-Master Master10.0.0.157mysql-5.7-slave slave# Configuring the Yum Warehouse CD/etc/Yum. REPOS.Dwgethttp//Mirrors.163.com/.help/centos6-base-163.repowgethttp//mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpmRPM-IVH epel-release-latest-6. noarch.rpmYumClean all &&Yummakecache# Configuring SSH TrustSsh-keygen-t RSACat/root/.SSH/id_rsa.pub >>/root/.SSH/Authorized_keysSSH-copy-IDslave# Check for residue packYumList|grepMySQLYum-y Remove mysql.x86_64Yum-Y-Remove mysql-libs.x86_64# Deleting the default location profile/etc/my.cnfRM-rf/etc/my.cnf# Creating a directorymkdir-p/app/mysql/etcmkdir-p/data/mysql/my3306# Creating a user Groupadd DBA&& Useradd MySQL-g dba# Download Source packagewgethttp//mirrors.sohu.com/mysql/mysql-5.7/mysql-boost-5.7.18.tar.gz# Unzip the source packageTar-ZXF mysql-boost-5.7. -.Tar. gz-c/usr/local/src/&& cd/usr/local/src/mysql-5.7. -# Install dependent packagesYum-YInstallNcurses Ncurses-develGCCLibtoolGCC-c++ MakeCMake Readline-devel Zlib-devel BisonPerl-module-Install.noarch # Pre-compilation Timecmake-dcmake_install_prefix=/app/MySQL-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_partition_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_archive_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_perfschema_storage_engine=1 -dwith_federated_storage_engine=1 -dwithout_example_storage_engine=1 -ddefault_charset=UTF8MB4-ddefault_collation=Utf8mb4_general_ci-dextra_charsets= All-denabled_local_infile= on-dwith_boost=/usr/local/src/mysql-5.7. -/Boost # recompile (optional) Make CleanRM-RF cmakecache.txt# compilation, installation Make&& Make Install# Copy configuration fileCP~/my.cnf/app/mysql/etc/my.cnfLN-s/app/mysql/etc/my.cnf/etc/my.cnf# Modify a directory to belong to a group, userChown-R mysql.dba/app/mysql/Chown-R mysql.dba/data/mysql/# Initialize Database/app/mysql/bin/mysqld--defaults-file=/app/mysql/etc/my.cnf--Initialize--basedir=/app/MySQL--datadir=/data/mysql/my3306--tmpdir=/data/mysql/my3306--user=mysql# Configuring environment variables Vim~/. Bash_profilemysql_base=/app/Mysqlpath= $PATH: $HOME/bin: $MYSQL _base/Binsource~/. bash_profile# Configuring SSL Login Mysql_ssl_rsa_setup--datadir=/data/mysql/my3306# copy Startup ScriptsCP/app/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld# Start database service mysqld start# get initialization password [[email protected]-5.7-master my3306]#grep 'Temporary password'/data/mysql/my3306/Error.log .- A-22T15: the: -.526557Z1[Note] A temporary password is generated for[Email protected]: bdjk&Nu:h2zl[[email protected]-5.7-slave my3306]#grep 'Temporary password'/data/mysql/my3306/Error.log .- A-25t17: +: -.298337Z1[Note] A temporary password is generated for[Email protected]: LR (; Egobl8q?# Log in to the database MySQL-uroot-p'Bdjk&nu:h2zl'MySQL-uroot-p'LR (; Egobl8q?'# Modify password and allow clients on other machines to log on to set global Validate_password_policy=0; # reset root password alter USER'Root'@'localhost'Identified by'[email protected]'; grant all privileges on*. * To'Root'@'%'Identified by'[email protected]'with grant option; # Quit and log back in to the database MySQL-uroot-p'[email protected]'# View database users and PermissionsSelectuser,host,authentication_string,account_locked from mysql.user;# set password-free login path Mysql_config_editor set--Login-path=my3306--user=Root--Password--port=3306 --socket=/data/mysql/my3306/mysql.sock# View password-free landing path Mysql_config_editor print--all# Remove password-free login path (optional) mysql_config_editor remove--Login-path=my3306# Local password-free login database MySQL--Login-path=my3306# Set boot chkconfig mysqld onchkconfig--list |grepMysql
mysql-5.7 (centos-6.9 environment) source installation