In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "Mysql 8.0 how to achieve source code compilation and installation", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "Mysql 8.0 how to achieve source code compilation and installation" this article.
First, the preparatory work 1. Download the installation package
Path: https://dev.mysql.com/downloads/mysql/
Choose mysq-8.0.16.tar.gz here
two。 Clean up existing versions
# # query
Rpm-qa | grep mysqlrpm-qa | grep maria
# # cleanup (if it exists)
Yum remove mysql
# # or
Yum remove mariadb3. Install dependency package (1) General dependency
Yum-y install gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-devel
(2) dependence on special versions
When compiling, the error prompt is respectively:
CMake 3.4.3 or higher is required.
GCC 5.3 or newer is required
So you need to install the relevant versions of Cmake and GCC
Please refer to: http://blog.itpub.net/69915315/viewspace-2648182
Second, compile and install (software) 1. Extract the installation package
Tar-zxvf tar-zxvf mysql-8.0.16.tar.gz2. Cmake configuration
(1) enter the directory mysql-8.0.16 and create a directory to store the compiled software.
Cd mysql-8.0.16 mkdir xiaochong
(2) enter the subdirectory xiaochong and configure it before compilation. The main cmake is. . To execute its parent directory
Cd xiaochong
Configuration parameters:
Cmake.. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DENABLED_LOCAL_INFILE=ON\-DWITH_INNODB_MEMCACHED=ON\-DWITH_SSL=system\-DWITH_FEDERATED_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITH_ARCHIVE_STORAGE_ENGINE=1\-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\-DCOMPILATION_COMMENT= "xiaochong edition"\-DDOWNLOAD_BOOST=1\-DWITH_BOOST=/ Usr/local/boost\-DCMAKE_CXX_COMPILER=/usr/bin/g++\-DWITH_BOOST=/tmp3. Compile make-j 104. Install make install
The following hint at the end indicates success.
-- Configuring done
-- Generating done
-- Build files have been written to: / software/mysql-8.0.16/xiaochong
-
Error 1: error: unrecognized command line option'- std=c++14'
Solution: add:-DCMAKE_CXX_COMPILER=/usr/bin/g++
Third, create the database 1, create the user groupadd mysqluseradd-g mysql mysql2. Create a related directory mkdir-p / data/mysql/ {3306j3307} / {data,log,tmp,innodb,innodb_log}
Here are the directories of two instances, 3306 and 3307, respectively.
After creation, the directory structure is as follows:
[root@mysql80 /] # cd data
[mysql@mysql80 data] $tree.
.
└── mysql
├── 3306
│ ├── data
│ ├── innodb
│ ├── innodb_log
│ ├── log
│ └── tmp
└── 3307
├── data
├── innodb
├── innodb_log
├── log
└── tmp
3. Modify directory permissions chown-R mysql:mysql / data/mysql/chown-R mysql:mysql / usr/local/mysql/4. Add the environment variable echo 'export PATH=$PATH:/usr/local/mysql/bin' > > / etc/profile source / etc/profile5. Add Profil
(1) 3306
Vim / data/mysql/3306/my3306.cnf
The contents are as follows:
[client] port=3306socket=/data/mysql/3306/ mysql.sock[mysqld] port=3306user=mysqlsocket=/data/mysql/3306/mysql.sockpid-file=/data/mysql/3306/mysql.pidbasedir=/usr/local/mysqldatadir=/data/mysql/3306/datatmpdir=/data/mysql/3306/tmpopen_files_limit=60000#explicit_defaults_for_timestampserver-id=3306lower_case_table_names=1character-set-server=utf8#federated#sql_mode=STRICT_TRANS_TABLESmax_connections=1000max_connect_errors=100000interactive_timeout=86400wait_timeout=86400sync_binlog=0back_log=100default-storage-engine=InnoDBlog_slave_updates=1#* * Logs related settings * log-bin=/data/mysql/3306/log/mysql3306-binbinlog_format=mixedbinlog_cache_size=32mmax_binlog_cache_size=64mmax_binlog_size=512mlong_query_time=1log_output=FILElog-error=/data/mysql/3306/log/mysql-error.logslow_query_log=1slow_query_log_file=/data/mysql/3306/log/slow_statement.log#log_queries_not_using_indexesgeneral_log=0general_log_file=/data/ Mysql/3306/log/general_statement.log#expire-logs-days = 14binlogqlAccording to repurchase logssecondspayment 1728000relayMUBING MySQL Replication New Feature*master-info-repository=TABLErelay-log-info-repository=TABLE#relay-log-recovery#* INNODB Specific options * MySQL Replication New Feature*master-info-repository=TABLErelay-log-info-repository=TABLE#relay-log-recovery#* INNODB Specific options * Innodb_buffer_pool_size=2048Mtransaction-isolation=REPEATABLE-READinnodb_buffer_pool_instances=8innodb_file_per_table=1innodb_data_home_dir=/data/mysql/3306/innodbinnodb_data_file_path=ibdata1:2048M:autoextendinnodb_thread_concurrency=8innodb_log_buffer_size=16Minnodb_log_file_size=128Minnodb_log_files_in_group=3innodb_log_group_home_dir=/data/mysql/3306/innodb_loginnodb_flush_log_at_trx_commit=2innodb_max_dirty_pages_pct=70innodb_flush_method=O_ DIRECT[mysql] no-auto- Rehashdefault-character-set=gbkprompt = (\ u @\ h) [\ d] >\ _
(1) 3307
Vim / data/mysql/3307/my3307.cnf
The contents are as follows:
[client] port=3307socket=/data/mysql/3307/ mysql.sock[mysqld] port=3307user=mysqlsocket=/data/mysql/3307/mysql.sockpid-file=/data/mysql/3307/mysql.pidbasedir=/usr/local/mysqldatadir=/data/mysql/3307/datatmpdir=/data/mysql/3307/tmpopen_files_limit=60000#explicit_defaults_for_timestampserver-id=3307lower_case_table_names=1character-set-server=utf8#federated#sql_mode=STRICT_TRANS_TABLESmax_connections=1000max_connect_errors=100000interactive_timeout=86400wait_timeout=86400sync_binlog=0back_log=100default-storage-engine=InnoDBlog_slave_updates=1#* * Logs related settings * log-bin=/data/mysql/3307/log/mysql3306-binbinlog_format=mixedbinlog_cache_size=32mmax_binlog_cache_size=64mmax_binlog_size=512mlong_query_time=1log_output=FILElog-error=/data/mysql/3307/log/mysql-error.logslow_query_log=1slow_query_log_file=/data/mysql/3307/log/slow_statement.log#log_queries_not_using_indexesgeneral_log=0general_log_file=/data/ Mysql/3307/log/general_statement.log#expire-logs-days = 14binlogqlAccording to repurchase logssecondspayment 1728000relayMUBING MySQL Replication New Feature*master-info-repository=TABLErelay-log-info-repository=TABLE#relay-log-recovery#* INNODB Specific options * MySQL Replication New Feature*master-info-repository=TABLErelay-log-info-repository=TABLE#relay-log-recovery#* INNODB Specific options * Innodb_buffer_pool_size=2048Mtransaction-isolation=REPEATABLE-READinnodb_buffer_pool_instances=8innodb_file_per_table=1innodb_data_home_dir=/data/mysql/3307/innodbinnodb_data_file_path=ibdata1:2048M:autoextendinnodb_thread_concurrency=8innodb_log_buffer_size=16Minnodb_log_file_size=128Minnodb_log_files_in_group=3innodb_log_group_home_dir=/data/mysql/3307/innodb_loginnodb_flush_log_at_trx_commit=2innodb_max_dirty_pages_pct=70innodb_flush_method=O_ DIRECT[mysql] no-auto- Rehashdefault-character-set=gbkprompt = (\ u @\ h) [\ d] >\ _ 6, Initialize the database
(1) 3306
Mysqld-defaults-file=/data/mysql/3306/my3306.cnf-initialize-user=mysql
(2) 3307
Mysqld-defaults-file=/data/mysql/3307/my3307.cnf-initialize-user=mysql
The error is as follows:
[mysql@mysql80] $mysqld-- defaults-file=/data/mysql/3306/my.cnf-- initialize-- user=mysql
Mysqld: / lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by mysqld)
Mysqld: / lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by mysqld)
Mysqld: / lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by mysqld)
Mysqld: / lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by mysqld)
Analytical method:
Reason: because we upgraded gcc, that is, gcc-5.3.0. But the library file under the directory / lib64/ is still linked to libstdc++.so.6 and the soft link is a lower version of libstdc++.so.6.0.19.
[root@mysql80 /] # cd / lib64/
[root@mysql80 lib64] # ls-l | grep libstdc++.so.6
Lrwxrwxrwx. 1 root root 19 Jun 19 14:36 libstdc++.so.6-> libstdc++.so.6.0.19
-rwxr-xr-x. 1 root root 991616 Apr 24 22:24 libstdc++.so.6.0.19
Go to the directory of the newly installed gcc-5.3.0, enter lib64, and view libstdc++.so.6. The soft link is libstdc++.so.6.0.21.
[root@mysql80 gcc-5.3.0] # cd lib64/
[root@mysql80 lib64] # ls-l | grep libstdc++.so.6
Lrwxrwxrwx. 1 root root 19 Jun 25 15:54 libstdc++.so-> libstdc++.so.6.0.21
Lrwxrwxrwx. 1 root root 19 Jun 25 15:54 libstdc++.so.6-> libstdc++.so.6.0.21
-rwxr-xr-x. 1 root root 11089328 Jun 25 15:54 libstdc++.so.6.0.21
Treatment: delete the original soft link and establish a new soft link:
[root@mysql80 lib64] # rm-rf libstdc++.so.6
[root@mysql80 lib64] # ln-s / usr/local/gcc-5.3.0/lib64/libstdc++.so.6 libstdc++.so.6
[root@mysql80 lib64] # ls-l | grep libstdc++.so.6
Lrwxrwxrwx. 1 root root 41 Jun 26 14:48 libstdc++.so.6-> / usr/local/gcc-5.3.0/lib64/libstdc++.so.6
7. Start the service
(1) 3306
/ mysqld_safe-defaults-file=/data/mysql/3306/my.cnf-user=mysql &
(2) 3307
/ mysqld_safe-defaults-file=/data/mysql/3307/my.cnf-user=mysql &
8. Log into the database
Here, take 3306 as an example. The 3307 steps are the same. You only need to pay attention to the port number, that is, uppercase-P
(1) find the initial password of root@localhost
View the current error log
More / data/mysql/3306/log/mysql-error.log
If you find the following line, the one marked red is the password:
[MY-010454] [Server] A temporary password is generated for root@localhost:? / ihz.ew8SIy
Mysql-uroot-paired impulse ihz.ew8SIy'-P3306-S / data/mysql/3306/mysql.sock
(2) Login
Mysql-uroot-paired impulse ihz.ew8SIy'-P3306-S / data/mysql/3306/mysql.sock
(3) change the password
ALTER USER 'root'@'localhost' IDENTIFIED WITH sha256_password BY' Yxc@3306' PASSWORD EXPIRE INTERVAL 360 DAY
(4) query the database
Ysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
4 rows in set (0.00 sec)
9. Verify the background process
The above is all the contents of the article "how to implement source code compilation and installation of Mysql 8.0". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.