CentOS6.9 + Mysql5.7.18 installation tutorial, centos6.9 install mysql
CentOS6.9 + Mysql5.7.18 source code installation, the following operations are performed under the root user.
1. Install dependency tools
cmake make3.75+ gcc4.4.6+ Boost1.59.0 bison ncursesyum install -y cmake,make,gcc,gcc-c++,bison, ncurses,ncurses-develcd /opt
Wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
Or want
tar -zxvf boost_1_59_0.tar.gz -C /usr/local/
2. Download mysql for Installation
Git clone https://github.com/mysql/mysql-server.git
Install yum install git without git
Select 5.7
Create a mysql user. The user group is root.
useradd -r -g root -s /bin/false mysql
3. Execute cmake
Mysql-server5.7cmake. cd/opt. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-DMYSQL_DATADIR =/usr/local/mysql/data \-DWITH_BOOST =/usr/local/boost_1_59_0 \-Timeout =/tmp/mysql. sock \-DSYSCONFDIR =/etc \-DEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-rows = 1 \-DEXTRA_CHARSETS = all-DCMAKE_INSTALL_PREFIX: installation path-packages: data storage directory-DWITH_BOOST: boost source code path-DSYSCONFDIR: my. cnf Configuration File directory-DEFAULT_CHARSET: Database default character encoding-DDEFAULT_COLLATION: Default sorting rule-DENABLED_LOCAL_INFILE: allows you to import data from this file-DEXTRA_CHARSETS: install all character sets 4. Compile and install make-j 'grep processor/proc/cpuinfo | wc-l' make install-j parameter to specify the number of threads for compilation based on the number of CPU cores, it can speed up compilation. If compilation fails, you need to delete the cache file of the pre-compilation configuration parameters generated by cmake and the files generated after the make compilation, and then re-compile the files. Cd/opt/mysql-server5.7rm-f CMakeCache.txt make clean
5. initialize the system database
vim /etc/my.cnf
Enter the insert mode and replace the original content with the following:
[client]port=3306socket=/temp/mysql.sock[mysqld]character-set-server=utf8collation-server=utf8_general_ciskip-external-lockingskip-name-resolveuser=mysqlport=3306basedir=/usr/local/mysqldatadir=/usr/local/mysql/datatmpdir=/usr/local/mysql/temp# server_id = .....socket=/usr/local/mysql/mysql.socklog-error=/usr/local/mysql/logs/mysql_error.logpid-file=/usr/local/mysql/mysql.pidopen_files_limit=10240back_log=600max_connections=500max_connect_errors=6000wait_timeout=605800#open_tables=600#table_cache = 650#opened_tables = 630max_allowed_packet=32Msort_buffer_size=4Mjoin_buffer_size=4Mthread_cache_size=300query_cache_type=1query_cache_size=256Mquery_cache_limit=2Mquery_cache_min_res_unit=16ktmp_table_size=256Mmax_heap_table_size=256Mkey_buffer_size=256Mread_buffer_size=1Mread_rnd_buffer_size=16Mbulk_insert_buffer_size=64Mlower_case_table_names=1default-storage-engine=INNODBinnodb_buffer_pool_size=2Ginnodb_log_buffer_size=32Minnodb_log_file_size=128Minnodb_flush_method=O_DIRECT#####################thread_concurrency=32long_query_time=2slow-query-log=onslow-query-log-file=/usr/local/mysql/logs/mysql-slow.log[mysqldump]quickmax_allowed_packet=32M[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidcd /usr/local/mysqlmkdir datamkdir logsmkdir tempchmod 0770 -R ../mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --socket=/tmp/mysql.sock
Before MySQL 5.7.6, it was bin/mysql_install_db -- user.
After the command is executed, check the logs/mysql_error.log file and write down the temporary root password.
A temporary password is generated for root@localhost: xxxxxxxxxx
6. Configure mysql
Chkconfig -- add mysqld # add to System service chkconfig mysqld on # start service mysqld start cannot be started successfully, start chown-R mysql in safe mode: root/var/run/mysqld. /bin/mysqld_safe -- defaults-file =/etc/my. cnf -- user = mysql &. /mysql-uroot-p
Enter the temporary password in mysql_error.log to log on to the mysql console.
set password='asdfghjkl'';Query OK, 0 rows affected (0.00 sec)show warnings;
Stop mysql
mysqladmin -u root -p shutdown
Enter the password you just set to stop successfully.
Next, you can use the system service to start mysql:
Service mysqld start # start the mysql service
The above section describes how to install CentOS6.9 + Mysql5.7.18 source code. I hope it will help you. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!