In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how Mysql8.0.18 attribute source code compilation and installation and gcc-9.2.0 upgrade, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.
1. Environment setting
[root@centos1 opt] # vim / etc/selinux/configSELINUX=disabled
2. Add directory settings to users
[root@centos1 opt] # id mysqlid: no such user [root@centos1 opt] # groupadd-g 101 mysql [root@centos1 opt] # useradd-u 514-g mysql-G root-d / home/mysql-m mysql [root@centos1 opt] # passwd mysqlChanging password for user mysql.New password:Retype new password: all authentication tokens updated successfully. [root@centos1 opt] # id mysqluid=514 (mysql) gid=101 (mysql) groups=101 (mysql) 0 (root) [root@centos1 opt] # mkdir-p / usr/local/mysql [root@centos1 opt] # chown-R mysql.mysql / usr/local/mysql [root@centos1 opt] # su-mysql Last login: Fri Oct 25 16:18:20 CST 2019 on pts/0 [mysql@centos1 ~] $vi .bash _ profilePATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/ MySQL [root @ centos1 ~] # mkdir-p / data/mysql/data [root@centos1 ~] # mkdir -p / data/mysql/log [root@centos1 ~] # mkdir-p / data/mysql/rum [root@centos1 ~] # mv / data/mysql/rum / data/mysql/run [root@centos1 ~] # mkdir-p / data/mysql/tmp [root@centos1 local] # chown-R 755 / usr/local/mysql
3. Extract the installation package mysql-8.0.18.tar.gz to / opt/mysql8
4. Installation dependency
Yum install-y gcc gcc-c++ ncurses-devel bison zlib libxml openssl
Update cmake3 installed through Yum
Yum install cmake3
After installation, it is found that the compilation does not pass the need to update gcc version 5 or above.
5. Gcc-9.2.0 compilation and installation
Reprint: https://www.2cto.com/net/201908/815589.html
Install gcc source code compilation dependency
# # compile gmp- > mpfr- > mpccd / usr/local/src/ compile: gmp-6.1.2tar-xvf gmp-6.1.2.tar.xzcd gmp-6.1.2./configure-- prefix=/usr/local/gmp-6.1.2make-j $(nproc) make installcd.. / compile: mpfr-4.0.2tar-xvf mpfr-4.0.2.tar.gzcd mpfr-4.0.2./configure-- prefix=/usr/local/mpfr -4.0.2-- with-gmp=/usr/local/gmp-6.1.2make-j $(nproc) make installcd.. / compile: mpc-1.1.0tar-xvf mpc-1.1.0.tar.gzcd mpc-1.1.0./configure-- prefix=/usr/local/mpc-1.1.0-- with-mpfr=/usr/local/mpfr-4.0.2-- with-gmp=/usr/local/gmp-6.1.2make-j $ (nproc) make install# adds mpfr lib to ld.so.conf or gcc compiling error echo / usr/local/mpfr-4.0.2/lib > > / etc/ld.so.confldconfig
Compile and install gcc
Cd / usr/local/src/tar-xvf gcc-9.2.0.tar.gzcd gcc-9.2.0./configure-- prefix=/usr/local/gcc-9.2.0\-enable-threads=posix\-disable-checking\-disable-multilib\-enable-languages=c C++\-with-gmp=/usr/local/gmp-6.1.2\-with-mpfr=/usr/local/mpfr-4.0.2\-with-mpc=/usr/local/mpc-1.1.0\-with-tune=generic\-with-arch_32=x86-64make-j $( Nproc) make install-j $(nproc) # # backup the old gcc executable file mv / usr/bin/gcc / usr/bin/gcc.old mv / usr/bin/g++ / usr/bin/g++.old mv / usr/bin/c++ / usr/bin/c++.old mv / usr/bin/cpp / usr/bin/cpp.old mv / usr/bin/gcov / usr/bin/gcov.old # # create the latest gcc executable soft chain ln-sf / usr/local/gcc- 9.2.0 lib64 bind * / usr/bin/ # # Delete the .py file in the lib64 directory or ldconfig will report an error rm-rf / usr/local/gcc-9.2.0/lib64/libstdc++.so.6.0.27-gdb.py echo / usr/local/gcc-9.2.0/lib64 > > / etc/ld.so.confldconfig## copy libstdc++.so.6.0.27 / lib64/cp / usr/local/gcc-9.2.0 / lib64/libstdc++.so.6.0.27 / lib64/# create soft chain libstdc++.so.6cd / lib64ln-sf libstdc++.so.6.0.27 libstdc++.so.6## to see if the latest version is strings / usr/lib64/libstdc++.so.6 | grep GLIBCXX
6. Cmake compiles mysql
(since different versions of gcc are installed, you can specify the version * important! * when compiling.)
Cmake3\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DEXTRA_CHARSETS=all\-DENABLED_LOCAL_INFILE=ON\-DWITH_INNODB_MEMCACHED=ON\-DWITH_INNOBASE_STORAGE_ENGINE=1\-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= "nancy edition"\-DDOWNLOAD_BOOST=1\ DWITH_BOOST=/data/mysql/tmp\-DMYSQL_UNIX_ADDR=/data/mysql/run/mysql.sock\-DMYSQL_TCP_PORT=3306\-DSYSCONFDIR=/data/mysql\-DWITH_READLINE=1\-DFORCE_INSOURCE_BUILD=1\-DWITH_SSL=system\-DWITH_ZLIB=system\-DCMAKE_CXX_COMPILER=/usr/local/gcc-9.2.0/bin/g++\-DCMAKE_C_COMPILER=/usr/local/gcc-9.2.0/bin/gcc
End of compilation:
-CMAKE_EXE_LINKER_FLAGS-- CMAKE_MODULE_LINKER_FLAGS-- CMAKE_SHARED_LINKER_FLAGS-- Configuring done-- Generating doneCMake Warning: Manually-specified variables were not used by the project: EXTRA_CHARSETS-- Build files have been written to: / opt/mysql8
Execute the installation to create the directory under the same directory:
Gmake-j $(nproc) gmake install-j $(nproc) compiled successfully: Scanning dependencies of target mysqld [100%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.oScanning dependencies of target pfs_connect_attr-t [100%] Linking CXX executable.. / runtime_output_directory/mysqld [100%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/pfs_connect_attr-t.cc.o [100%] Building CXX object storage/perfschema/unittest / CMakeFiles/pfs_connect_attr-t.dir/__/sql/sql_builtin.cc.o [100%] Linking CXX executable. / runtime_output_directory/pfs_connect_attr-t [100%] Built target mysqld [100%] Built target pfs_connect_attr-t [root@centos1 mysql8] #
View the catalog:
[root@centos1 mysql] # lltotal 932drwxr-xr-x 2 root root 4096 Oct 30 14:54 bindrwxr-xr-x 2 root root 86 Oct 30 14:54 docsdrwxr-xr-x 3 root root 282 Oct 30 14:53 includedrwxr-xr-x 6 root root 4096 Oct 30 14:54 lib-rw-r--r-- 1 root root 408918 Sep 20 16:30 LICENSE-rw-r--r-- 1 root root 102977 Sep 20 16:30 LICENSE.router-rw-r--r- -1 root root 408918 Sep 20 16:30 LICENSE-testdrwxr-xr-x 4 root root 30 Oct 30 14:54 mandrwxr-xr-x 10 root root 4096 Oct 30 14:54 mysql-test-rw-r--r-- 1 root root 687 Sep 20 16:30 README-rw-r--r-- 1 root root Sep 20 16:30 README.router-rw-r--r-- 1 root root 687 Sep 20 16:30 README-testdrwxrwxr-x 2 root root 6 Oct 30 14:54 rundrwxr-xr-x 28 root root 4096 Oct 30 14:54 sharedrwxr-xr-x 2 root root 77 Oct 30 14:54 support-filesdrwxr-xr-x 3 root root 17 Oct 30 14:54 var
7. Set Mysql user system parameters
[root@localhost cmake-3.0.1] # vi / etc/security/limits.confmysql soft nproc 65536mysql hard nproc 65536mysql soft nofile 65536mysql hard nofile 65536
8. Configure the startup file
[root@centos1 support-files] # echo export PATH=$PATH:/usr/local/mysql/bin > > / etc/profile [root@centos1 support-files] # echo / usr/local/mysql/lib > > / etc/ld.so.conf [root@centos1 support-files] # ldconfig
# copy startup files
[root@centos1 support-files] # cp mysql.server / etc/init.d/mysqld [root@centos1 support-files] # chmod 700 / etc/init.d/mysqld [mysql@centos1 mysql] $vi / data/mysql/my.cnf
[client]
Port = 3306
Socket = / data/mysql/run/mysql.sock
# The MySQL server
[mysqld]
Port = 3306
User = mysql
Socket = / data/mysql/run/mysql.sock
Pid_file = / data/mysql/mysqld.pid
Basedir = / usr/local/mysql
Datadir = / data/mysql/data
Tmpdir = / data/mysql/tmp
Open_files_limit = 65535
Explicit_defaults_for_timestamp
Server_id = 1
Lower_case_table_names = 1
Character_set_server = utf8
# sql_mode=STRICT_TRANS_TABLES
#
# * security
Safe_user_create
Max_connections = 3000
Max_user_connections=2980
Secure_file_priv=/data/mysql/tmp
Max_connect_errors = 100000
Interactive_timeout = 86400
Wait_timeout = 86400
Sync_binlog=100
Back_log=1024
Max_binlog_cache_size=2147483648
Max_binlog_size=524288000
Default_storage_engine = InnoDB
Log_slave_updates = 1
# * Logs related settings *
Log_bin = / data/mysql/binlog/mysql-bin
[mysql@centos1 mysql] $more / date/mysql/my.cnf
/ date/mysql/my.cnf: No such file or directory
[mysql@centos1 mysql] $more / data/mysql/my.cnf
[client]
Port = 3306
Socket = / data/mysql/run/mysql.sock
# The MySQL server
[mysqld]
Port = 3306
User = mysql
Socket = / data/mysql/run/mysql.sock
Pid_file = / data/mysql/mysqld.pid
Basedir = / usr/local/mysql
Datadir = / data/mysql/data
Tmpdir = / data/mysql/tmp
Open_files_limit = 65535
Explicit_defaults_for_timestamp
Server_id = 1
Lower_case_table_names = 1
Character_set_server = utf8
# sql_mode=STRICT_TRANS_TABLES
#
# * security
Safe_user_create
Max_connections = 3000
Max_user_connections=2980
Secure_file_priv=/data/mysql/tmp
Max_connect_errors = 100000
Interactive_timeout = 86400
Wait_timeout = 86400
Sync_binlog=100
Back_log=1024
Max_binlog_cache_size=2147483648
Max_binlog_size=524288000
Default_storage_engine = InnoDB
Log_slave_updates = 1
# * Logs related settings *
Log_bin = / data/mysql/binlog/mysql-bin
Binlog_format= mixed
Binlog_cache_size=32m
Max_binlog_cache_size=64m
Max_binlog_size=512m
Long_query_time = 1
Log_output = FILE
Log_error = / data/mysql/mysql-error.log
Slow_query_log = 1
Slow_query_log_file = / data/mysql/slow_statement.log
Log_queries_not_using_indexes=0
Log_slave_updates=ON
Log_slow_admin_statements=1
General_log = 0
General_log_file = / data/mysql/general_statement.log
Binlog_expire_logs_seconds = 1728000
Relay_log = / data/mysql/binlog/relay-bin
Relay_log_index = / data/mysql/binlog/relay-bin.index
# * MySQL Replication New Feature*
Master_info_repository=TABLE
Relay-log-info-repository=TABLE
Relay-log-recovery
# * INNODB Specific options *
Innodb_buffer_pool_size = 4096m
Transaction_isolation=REPEATABLE-READ
Innodb_buffer_pool_instances = 8
Innodb_file_per_table = 1
Innodb_data_home_dir = / data/mysql/innodb_ts
Innodb_data_file_path = ibdata1:2048M:autoextend
Innodb_thread_concurrency = 8
Innodb_log_buffer_size = 67108864
Innodb_log_file_size = 1048576000
Innodb_log_files_in_group = 4
Innodb_max_undo_log_size=4G
Innodb_undo_directory=/data/mysql/undo_space
Innodb_log_group_home_dir = / data/mysql/innodb_log
Innodb_adaptive_flushing=ON
Innodb_flush_log_at_trx_commit = 2
Innodb_max_dirty_pages_pct = 60
Innodb_open_files=60000
Innodb_purge_threads=1
Innodb_read_io_threads=4
Innodb_stats_on_metadata=OFF
Innodb_flush_method=O_DIRECT
[mysql]
No-auto-rehash
Default-character-set=UTF8MB4
# prompt = (\ u@\ h) [\ d] >\ _
Net-buffer-length=64K
Unbuffered
Max-allowed-packet = 2G
# some var for mysql8
# log_error_verbosity=3
# innodb_print_ddl_logs=1
# binlog_expire_logs_seconds=259200
# innodb_dedicate_server=0
#
# innodb_status_file=1
# innodb_status_output=0
# innodb_status_output_locks=0
[mysqldump]
Quick
Max_allowed_packet=2G
Log_error=/data/mysql/log/mysqld/dump.log
Net_buffer_length=8k
9. Initialize
$/ usr/local/mysql/bin/mysqld-defaults-file=/data/mysql/my.cnf-initialize-user=mysql
View initialization log and password
[mysql@centos1 mysql] $vi mysql-error.log
2019-10-31T03:30:00.222973Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: j63rKGLr3j-L
10. Start the mysql service
$/ usr/local/mysql/bin/mysqld_safe-defaults-file=/data/mysql/my.cnf-user=mysql &
Log in
[mysql@centos1 bin] $mysql-uroot-pj63rKGLr3j-L
Mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 8
Server version: 8.0.18
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > show variable
ALTER USER 'root'@'localhost' IDENTIFIED WITH sha256_password BY' mysqlWAI' PASSWORD EXPIRE INTERVAL 360 DAY
Shut down the database
[mysql@centos1 bin] $mysqladmin-uroot-pmysqlWAI-socket=/data/mysql/run/mysql.sock shutdown &
Done!
On "Mysql8.0.18 how to attribute source code compilation and installation and gcc-9.2.0 upgrade" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
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.