MySQL 5.7.17 latest stable version installation tutorial in linux, MySQL 5.7.17 stable version
Install mysql latest stable version: mysql-5.7.17 on linux Through source code
To facilitate the installation without the boostdependency, download mysql-boost-5.7.17.tar.gz from the official network. (Boost is required in the compilation process, but it is not actually used .)
Installation directory:
Startup Script:/etc/init. d/mysqld
Program root directory:/usr/local/mysql
Data Directory:/data/mysql
Installation Process
1. Install Dependencies
#yum install -y cmake gcc-c++* make ncurses-devel
2. Create a mysql user
#groupadd mysql#useradd -r -g mysql -s /bin/false mysql
3.download mysql-boost-5.7.17.tar.gz and upload it to the server.
# Tar xzf mysql-5.7.17.tar.gz # cd mysql-5.7.17 # mkdir bld # cd bld/# cmake .. -DWITH_BOOST = .. /boost/-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/data/mysql # specify the parameter here to reduce the number of subsequent operations during startup # make install # use the default configuration File # cd/usr/local/mysql/support-files # cp my-default.cnf .. /my. cnf # if an error occurs during compilation, clear the temporary file and re-compile: # make clean # rm CMakeCache.txt
4. After installation, add the executable file path to the system environment variable:
Environment Variable
#echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile#source /etc/profile
5. initialize the database
#mkdir /data/mysql#chown -R mysql.mysql /data/mysql#mysqld --defaults-file=/usr/local/mysql/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/
After mysql5.7 is initialized, a random password is generated, which is directly displayed on the screen.
6. Start
Copy the startup script:
#cd /usr/local/mysql/support-files#cp mysql.server /etc/init.d/mysql
Start directly
# Mysqld_safe -- user = mysql & or #/etc/init. d/mysqld start
Call the security script after startup to change the root password, delete the test database, and disable remote root login.
#mysql_secure_installation
Some configurations (not optimized)
[client]port=3306socket=/tmp/mysql.sockcharacter_set_client= utf8[mysqld]basedir = /usr/local/mysqldatadir = /data/mysqlport = 3306socket = /tmp/mysql.sockcharacter-set-server = utf8read_buffer_size=131072#innodbinnodb_data_file_path=ibdata1:100M:autoextend#binlogserver_id=1log-bin=mysql-binsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES[mysqldump]quickmax_allowed_packet=32M[mysql][myisamchk]
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.