1. Download MySQL URL: https://dev.mysql.com/downloads/mysql/ 2. Select the source package, click to download the general version Just download it without logging in 3. Unzip and compile tar -zxvf mysql-5.7.19.tar.gz cd mysql-5.7.19.tar.gz Create a data directory Compile with cmake first. If there is no such command, you need to install it with yum first. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ #This is the location of the mysql directory after compilation and installation. You can change it yourself -DMYSQL_DATADIR=/data/mysql/ #This points to the data directory -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/usr/local/mysql-5.7/conf/ -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_SSL=system -DWITH_ZLIB=system -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost #Starting from MySQL 5.7.5, the Boost library must be installed After compiling, After the installation is complete, there will be a directory mysql under the path /usr/local/. This directory is the path I compiled and installed. DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ Generally, for security reasons, we will create a mysql user and mysql group and execute the following command #Add user group groupadd mysql #Add user mysql to user group mysql useradd -g mysql mysql Grant mysql permissions chown -R mysql:mysql mysql #Add user group groupadd mysql #Add user mysql to user group mysql useradd -g mysql mysql Grant mysql permissions chown -R mysql:mysql mysql 4. Next, configure the startup direction and set it to start at boot Configure [client] ort = 3306 ocket = /tmp/mysql.sock default-character-set = utf8mb4 [mysqld] ort = 3306 ocket = /tmp/mysql.sock asedir = /usr/local/mysql datadir = /data/mysql id-file = /data/mysql/mysql.pid user = mysql ind-address = 0.0.0.0 erver-id = 1 init-connect = 'SET NAMES utf8mb4' character-set-server = utf8mb4 #skip-name-resolve #skip-networking ack_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 max_allowed_packet = 4M inlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M read_buffer_size = 2M read_rnd_buffer_size = 8M ort_buffer_size = 8M join_buffer_size = 8M key_buffer_size = 4M thread_cache_size = 8 query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M ft_min_word_len = 4 log_bin = mysql-bi inlog_format = mixed expire_logs_days = 30 log_error = /data/mysql/mysql-error.log low_query_log = 1 long_query_time = 1 low_query_log_file = /data/mysql/mysql-slow.log erformance_schema = 0 explicit_defaults_for_timestamp #lower_case_table_names = 1 kip-external-locking default_storage_engine = InnoDB #default-storage-engine = MyISAM innodb_file_per_table = 1 innodb_open_files = 500 innodb_buffer_pool_size = 64M innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_thread_concurrency = 0 innodb_purge_threads = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 2M innodb_log_file_size = 32M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 ulk_insert_buffer_size = 8M myisam_sort_buffer_size = 8M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 interactive_timeout = 28800 wait_timeout = 28800 [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer_size = 8M ort_buffer_size = 8M read_buffer = 4M write_buffer = 4M Next, execute the initialization database statement: Note that /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql This step is very important. If you start the database directly without initialization, an error will be reported. ERROR! The server quit without updating PID file (/data/mysql/mysql.pid). If the initialization fails or reports the following error, you need to clear your /data/mysql directory first, because there is data under the mysql directory, so the initialization execution is terminated. 2017-08-29T13:39:47.241469Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.2017-08-29T13:39:47.241536Z 0 [ERROR] Aborting Clear and then re-initialize /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql Next you can start mysql service mysqld start Login Test /usr/local/mysql/bin/mysql -uroot - Because the initialization If login error occurs ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Check whether you have successfully started the database. You can execute Empty password is not safe, so we need to set a password. The "root" in the following command is the password setting area. My password is set to root. You can modify it yourself. [root@localhost local]# /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"root\" with grant option;"[root@localhost local]# /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"root\" with grant option;" Next, log in again to test the password change and if it is successful, you are done! Summarize The above is a detailed tutorial on how to install Mysql5.7.19 on Centos7 under Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Comprehensive explanation of CocosCreator hot update
>>: Tips for viewing History records and adding timestamps in Linux
Preface For file or directory permissions in Linu...
Sometimes you may need to modify or add exposed p...
Table of contents Preface React Functional Compon...
Body part: <button>Turn on/off light</bu...
Step 1: Add Ubuntu source Switch to root su root ...
Generally speaking, the mouse is displayed as an u...
Phrase elements such as <em></em> can ...
When updating a record in MySQL, the syntax is co...
First we need to know the self-calling of the fun...
Preface Not long ago, I combined browser-sync+gul...
What is HTTP Compression Sometimes, relatively la...
Table of contents 01 Common Faults 1 02 Common Fa...
Notes on installing MySQL database, share with ev...
The principle of uploading pictures on the front ...
Table of contents 1. context 1. Usage scenarios 2...