In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on the "MySQL5.6 source code compilation and installation process", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the process of compiling and installing MySQL5.6 source code".
(1) turn off the firewall and Selinux
[root@localhost ~] # service iptables status
Iptables: Firewall is not running.
[root@localhost ~] # cat / etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing-SELinux security policy is enforced.
# permissive-SELinux prints warnings instead of enforcing.
# disabled-No SELinux policy is loaded.
SELINUX=disabled
[root@localhost ~] # chkconfig iptables off
(2) download the MySQL 5.6 source package
Https://dev.mysql.com/downloads/mysql/5.6.html#downloads
After downloading, upload the source code package to the server
(3) add users and groups
[root@localhost ~] # groupadd mysql
[root@localhost] # useradd-d / home/mysql-g mysql-m mysql
[root@localhost ~] # passwd mysql
Configure environment variables
[root@localhost ~] # su-mysql
[mysql@localhost ~] $vim .bash _ profile
[mysql@localhost ~] $cat .bash _ profile
# .bash _ profile
# Get the aliases and functions
If [- f ~ / .bashrc]; then
. ~ / .bashrc
Fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/mysql_software_56/bin
Export PATH
(4) create relevant directories
Create a software catalog
[root@localhost ~] # mkdir / mysql_software_56
Create data file directory and log directory
[root@localhost] # mkdir-p / my3306/data
[root@localhost] # mkdir-p / my3306/log/iblog
[root@localhost] # mkdir-p / my3306/log/binlog
Create a directory for storing Pid and temporary files
[root@localhost] # mkdir-p / my3306/run
[root@localhost] # mkdir-p / my3306/tmp
Change permissions
[root@localhost] # chown-R mysql:mysql / my3306
[root@localhost] # chmod-R 755 / my3306
(5) unpack the MySQL 5.6 installation package and install cmake
[root@localhost ~] # cd / install/
[root@localhost install] # tar xvfz mysql-5.6.37.tar.gz
[root@localhost install] # yum install-y cmake gcc gcc-c++ ncurses-devel zlib libxml openssl
(6) compile and install
[root@localhost install] # cd mysql-5.6.37
[root@localhost mysql-5.6.37] # cmake. -DCMAKE_INSTALL_PREFIX=/mysql_software_56\
>-DINSTALL_DATADIR=/my3306/data\
>-DDEFAULT_CHARSET=utf8\
>-DDEFAULT_COLLATION=utf8_general_ci\
>-DEXTRA_CHARSETS=all\
>-DWITH_SSL=yes\
>-DWITH_EMBEDDED_SERVER=1\
>-DWITH_MYISAM_STORAGE_ENGINE=1\
>-DWITH_INNOBASE_STORAGE_ENGINE=1\
>-DWITH_FEDERATED_STORAGE_ENGINE=1\
>-DWITH_ARCHIVE_STORAGE_ENGINE=1\
>-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
>-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\
>-DWITH_PARTITION_STORAGE_ENGINE=1\
>-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\
>-DMYSQL_UNIX_ADDR=/my3306/run/mysql.sock\
>-DMYSQL_TCP_PORT=3306\
>-DSYSCONFDIR=/etc\
>-DENABLED_LOCAL_INFILE=ON\
>-DCOMPILATION_COMMENT='MySQL 5.6production environment'\
>-DWITH_READLINE=ON
[root@localhost mysql-5.6.37] # make
[root@localhost mysql-5.6.37] # make install
(7) configure MySQL parameter file
[root@localhost tmp] # cat / etc/my_5.6_3306.cnf
[client]
Port=3306
Socket=/my3306/run/mysql.sock
[mysql]
Pid_file=/my3306/run/mysqld.pid
[mysqld]
Autocommit=1
General_log=off
Explicit_defaults_for_timestamp=true
# system
Basedir=/mysql_software_56
Datadir=/my3306/data
Max_allowed_packet=1g
Max_connections=3000
Max_user_connections=2800
Open_files_limit=65535
Pid_file=/my3306/run/mysqld.pid
Port=3306
Server_id=101
Skip_name_resolve=ON
Socket=/my3306/run/mysql.sock
Tmpdir=/my3306/tmp
# binlog
Log_bin=/my3306/log/binlog/binlog
Binlog_cache_size=32768
Binlog_format=row
Expire_logs_days=7
Log_slave_updates=ON
Max_binlog_cache_size=2147483648
Max_binlog_size=524288000
Sync_binlog=100
# logging
Log_error=/my3306/log/error.log
Slow_query_log_file=/my3306/log/slow.log
Log_queries_not_using_indexes=0
Slow_query_log=1
Log_slave_updates=ON
Log_slow_admin_statements=1
Long_query_time=1
# relay
Relay_log=/my3306/log/relaylog
Relay_log_index=/my3306/log/relay.index
Relay_log_info_file=/my3306/log/relay-log.info
# slave
Slave_load_tmpdir= / my3306/tmp
Slave_skip_errors=OFF
# innodb
Innodb_data_home_dir=/my3306/log/iblog
Innodb_log_group_home_dir=/my3306/log/iblog
Innodb_adaptive_flushing=ON
Innodb_adaptive_hash_index=ON
Innodb_autoinc_lock_mode=1
Innodb_buffer_pool_instances=8
# default
Innodb_change_buffering=inserts
Innodb_checksums=ON
Innodb_buffer_pool_size= 128M
Innodb_data_file_path=ibdata1:32M;ibdata2:16M:autoextend
Innodb_doublewrite=ON
Innodb_file_format=Barracuda
Innodb_file_per_table=ON
Innodb_flush_log_at_trx_commit=1
Innodb_flush_method=O_DIRECT
Innodb_io_capacity=1000
Innodb_lock_wait_timeout=10
Innodb_log_buffer_size=100M
Innodb_log_file_size=1048576000
Innodb_log_files_in_group=4
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_support_xa=ON
Innodb_use_native_aio=OFF
Innodb_write_io_threads=10
[mysqld_safe]
Datadir=/my3306/data
(8) initialize MySQL
[root@localhost mysql_software_56] # / mysql_software_56/scripts/mysql_install_db-defaults-file=/etc/my_5.6_3306.cnf-datadir=/my3306/data/-user=mysql
Installing MySQL system tables...2017-07-29 02:01:18 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.
2017-07-29 02:01:18 0 [Note]. / bin/mysqld (mysqld 5.6.37-log) starting as process 50198.
OK
Filling help tables...2017-07-29 02:03:47 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.
2017-07-29 02:03:47 0 [Note]. / bin/mysqld (mysqld 5.6.37-log) starting as process 50239.
OK
To start mysqld at boot time you have to copy
Support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!
To do so, start the server, then issue the following commands:
/ mysql_software_56/bin/mysqladmin-u root password' new-password'
/ mysql_software_56/bin/mysqladmin-u root-h localhost.localdomain password' new-password'
Alternatively you can run:
/ mysql_software_56/bin/mysql_secure_installation
Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
Cd. ; / mysql_software_56/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
Cd mysql-test; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
Http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as. / my.cnf and
Will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file / etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
-- defaults-file argument to mysqld_safe when starting the server
Start the database
[root@localhost mysql_software_56] # / mysql_software_56/bin/mysqld_safe-defaults-file=/etc/my_5.6_3306.cnf-user=mysql &
[1] 50284
[root@localhost mysql_software_56] # 170729 02:07:56 mysqld_safe Logging to'/ my3306/log/error.log'.
170729 02:07:56 mysqld_safe Starting mysqld daemon with databases from / my3306/data
At this point, I believe that everyone on the "MySQL5.6 source code compilation and installation process" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.