In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to compile and install Mysql5.6 or Centos6.5 source code, the content is very detailed, interested friends can refer to, hope to help you.
# # different servers need to change server_id, and port needs to be changed on the same machine
1. Turn off the firewall
[root@mysql ~] # service iptables status-- View firewall status
[root@mysql ~] # service iptables stop-- turn off the firewall
[root@mysql ~] # chkconfig iptables off-permanently closed
[root@mysql ~] # vim / etc/sysconfig/selinux
SELINUX=disabled
two。 Configure sysctl.conf
It is recommended to configure the virtual machine according to the situation in the production environment, and the virtual machine installation may not be set up.
3. Check whether mysql is installed on the operating system, and if so, uninstall it
[root@mysql yum.repos.d] # rpm-qa | grep mysql
[root@mysql yum.repos.d] # yum remove mysql
4. Download the mysql source code package
Https://dev.mysql.com/downloads/file/?id=469012
5. Add users and groups
[root@mysql U01] # userdel-r mysql-deleting the previous mysql user-r deletes the accompanying group
[root@mysql u01] # groupadd mysql
[root@mysql U01] # useradd-d / home/mysql-g mysql-m mysql
[root@mysql u01] # passwd mysql
Changing password for user mysql.
New password:
BAD PASSWORD: it is based ona dictionary word
Retype new password:
Passwd: all authentication tokens updated successfully.
[root@mysql u01] # id mysql
Uid=500 (mysql) gid=500 (mysql) groups=500 (mysql)
6. Configure mysql environment variables
[mysql@mysql ~] $vim .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:/u01/my3306/bin
Export PATH
[mysql@mysql ~] $source .bash _ profile
7. Create directory and authorization
[root@mysql u01] # cd / u01
[root@mysql U01] # mkdir-p / u01/my3306/data
[root@mysql U01] # mkdir-p / u01/my3306/log/iblog
[root@mysql U01] # mkdir-p / u01/my3306/log/binlog
[root@mysql U01] # mkdir-p / u01/my3306/run
[root@mysql U01] # mkdir-p / u01/my3306/tmp
[root@mysql U01] # chown-R mysql:mysql / u01/my3306
[root@mysql u01] # chmod 755 / u01/my3306
8. Decompress mysql
[root@mysql U01] # tar-xzvf mysql-5.6.36.tar.gz
9. Configure yum source, install cmakle and some required packages, version 2.6 or above is required
Yum install-y cmake gcc gcc-c++ ncurses-devel bison zlib libxml openssl
10. Compile and install
Cmake\
-DCMAKE_INSTALL_PREFIX=/u01/my3306\
-DINSTALL_DATADIR=/u01/my3306/data\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=all\-
-DWITH_SSL=yes\-- secure socket
-DWITH_EMBEDDED_SERVER=1\
-DENABLED_LOCAL_INFILE=1\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWITH_FEDERATED_STORAGE_ENGINE=1\
-DWITH_PARTITION_STORAGE_ENGINE=1\
-DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock\
-DMYSQL_TCP_PORT=3306\
-DENABLED_LOCAL_INFILE=1\
-DSYSCONFDIR=/etc\
-DWITH_READLINE=on
[root@mysql mysql-5.6.36] # cd mysql-5.6.36
[root@mysql mysql-5.6.36] # cmake-DCMAKE_INSTALL_PREFIX=/u01/my3306-DINSTALL_DATADIR=/u01/my3306/data-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DEXTRA_CHARSETS=all-DEXTRA_CHARSETS=all-DWITH_EMBEDDED_SERVER=1-DENABLED_LOCAL_INFILE=1-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_FEDERATED_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR= / u01/my3306/run/mysql.sock-DMYSQL_TCP_PORT=3306-DENABLED_LOCAL_INFILE=1-DSYSCONFDIR=/etc-DWITH_READLINE=on
[root@mysql mysql-5.6.36] # make
[root@mysql mysql-5.6.36] # make install
11. Configure mysql parameters
[root@mysql my3306] # pwd
/ u01/my3306
[root@mysql my3306] # cat my.cnf
[client]
Port=3306
Socket=/u01/my3306/mysql.sock
[mysql]
Pid_file=/u01/my3306/run/mysqld.pid
[mysqld]
Autocommit=1
General_log=off
Explicit_defaults_for_timestamp=true
# system
Basedir=/u01/my3306
Datadir=/u01/my3306/data
Max_allowed_packet=1g
Max_connections=3000
Max_user_connections=2800
Open_files_limit=65535
Pid_file=/u01/my3306/run/mysqld.pid
Port=3306
Server_id=101
Skip_name_resolve=ON
Socket=/u01/my3306/run/mysql.sock
Tmpdir=/u01/my3306/tmp
# binlog
Log_bin=/u01/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=/u01/my3306/log/error.log
Slow_query_log_file=/u01/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=/u01/my3306/log/relaylog
Relay_log_index=/u01/my3306/log/relay.index
Relay_log_info_file=/u01/my3306/log/relay-log.info
# slave
Slave_load_tmpdir=/u01/my3306/tmp
Slave_skip_errors=OFF # innodb
Innodb_data_home_dir=/u01/my3306/log/iblog
Innodb_log_group_home_dir=/u01/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=67108864
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]
[root@mysql my3306] # chown-R mysql:mysql / u01/my3306
twelve。 Initialize mysql script
[root@mysql my3306] # / scripts/mysql_install_db-- defaults-file=/u01/my3306/my.cnf-- datadir=/u01/my3306/data-- user=mysql
13. Start mysql
[mysql@mysql bin] $. / mysqld_safe-- defaults-file=/u01/my3306/my.cnf-- user=mysql &
[1] 17237
[mysql@mysql bin] $170612 06:37:02 mysqld_safe Logging to'/ u01 mysqld_safe Logging to'/ my3306 ash.
170612 06:37:02 mysqld_safe Starting mysqld daemon with databases from / u01/my3306/data
[mysql@mysql bin] $mysql
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.6.36-log Source distribution
Copyright (c) 2000, 2017, 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 >
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | test |
+-+
4 rows in set (0.10 sec)
# # different servers need to change server_id, and port needs to be changed on the same machine
1. Turn off the firewall
[root@mysql ~] # service iptables status-- View firewall status
[root@mysql ~] # service iptables stop-- turn off the firewall
[root@mysql ~] # chkconfig iptables off-permanently closed
[root@mysql ~] # vim / etc/sysconfig/selinux
SELINUX=disabled
two。 Configure sysctl.conf
It is recommended to configure the virtual machine according to the situation in the production environment, and the virtual machine installation may not be set up.
3. Check whether mysql is installed on the operating system, and if so, uninstall it
[root@mysql yum.repos.d] # rpm-qa | grep mysql
[root@mysql yum.repos.d] # yum remove mysql
4. Download the mysql source code package
Https://dev.mysql.com/downloads/file/?id=469012
5. Add users and groups
[root@mysql U01] # userdel-r mysql-deleting the previous mysql user-r deletes the accompanying group
[root@mysql u01] # groupadd mysql
[root@mysql U01] # useradd-d / home/mysql-g mysql-m mysql
[root@mysql u01] # passwd mysql
Changing password for user mysql.
New password:
BAD PASSWORD: it is based ona dictionary word
Retype new password:
Passwd: all authentication tokens updated successfully.
[root@mysql u01] # id mysql
Uid=500 (mysql) gid=500 (mysql) groups=500 (mysql)
6. Configure mysql environment variables
[mysql@mysql ~] $vim .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:/u01/my3306/bin
Export PATH
[mysql@mysql ~] $source .bash _ profile
7. Create directory and authorization
[root@mysql u01] # cd / u01
[root@mysql U01] # mkdir-p / u01/my3306/data
[root@mysql U01] # mkdir-p / u01/my3306/log/iblog
[root@mysql U01] # mkdir-p / u01/my3306/log/binlog
[root@mysql U01] # mkdir-p / u01/my3306/run
[root@mysql U01] # mkdir-p / u01/my3306/tmp
[root@mysql U01] # chown-R mysql:mysql / u01/my3306
[root@mysql u01] # chmod 755 / u01/my3306
8. Decompress mysql
[root@mysql U01] # tar-xzvf mysql-5.6.36.tar.gz
9. Configure yum source, install cmakle and some required packages, version 2.6 or above is required
Yum install-y cmake gcc gcc-c++ ncurses-devel bison zlib libxml openssl
10. Compile and install
Cmake\
-DCMAKE_INSTALL_PREFIX=/u01/my3306\
-DINSTALL_DATADIR=/u01/my3306/data\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=all\-
-DWITH_SSL=yes\-- secure socket
-DWITH_EMBEDDED_SERVER=1\
-DENABLED_LOCAL_INFILE=1\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWITH_FEDERATED_STORAGE_ENGINE=1\
-DWITH_PARTITION_STORAGE_ENGINE=1\
-DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock\
-DMYSQL_TCP_PORT=3306\
-DENABLED_LOCAL_INFILE=1\
-DSYSCONFDIR=/etc\
-DWITH_READLINE=on
[root@mysql mysql-5.6.36] # cd mysql-5.6.36
[root@mysql mysql-5.6.36] # cmake-DCMAKE_INSTALL_PREFIX=/u01/my3306-DINSTALL_DATADIR=/u01/my3306/data-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DEXTRA_CHARSETS=all-DEXTRA_CHARSETS=all-DWITH_EMBEDDED_SERVER=1-DENABLED_LOCAL_INFILE=1-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_FEDERATED_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR= / u01/my3306/run/mysql.sock-DMYSQL_TCP_PORT=3306-DENABLED_LOCAL_INFILE=1-DSYSCONFDIR=/etc-DWITH_READLINE=on
[root@mysql mysql-5.6.36] # make
[root@mysql mysql-5.6.36] # make install
11. Configure mysql parameters
[root@mysql my3306] # pwd
/ u01/my3306
[root@mysql my3306] # cat my.cnf
[client]
Port=3306
Socket=/u01/my3306/mysql.sock
[mysql]
Pid_file=/u01/my3306/run/mysqld.pid
[mysqld]
Autocommit=1
General_log=off
Explicit_defaults_for_timestamp=true
# system
Basedir=/u01/my3306
Datadir=/u01/my3306/data
Max_allowed_packet=1g
Max_connections=3000
Max_user_connections=2800
Open_files_limit=65535
Pid_file=/u01/my3306/run/mysqld.pid
Port=3306
Server_id=101
Skip_name_resolve=ON
Socket=/u01/my3306/run/mysql.sock
Tmpdir=/u01/my3306/tmp
# binlog
Log_bin=/u01/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=/u01/my3306/log/error.log
Slow_query_log_file=/u01/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=/u01/my3306/log/relaylog
Relay_log_index=/u01/my3306/log/relay.index
Relay_log_info_file=/u01/my3306/log/relay-log.info
# slave
Slave_load_tmpdir=/u01/my3306/tmp
Slave_skip_errors=OFF # innodb
Innodb_data_home_dir=/u01/my3306/log/iblog
Innodb_log_group_home_dir=/u01/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=67108864
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]
[root@mysql my3306] # chown-R mysql:mysql / u01/my3306
twelve。 Initialize mysql script
[root@mysql my3306] # / scripts/mysql_install_db-- defaults-file=/u01/my3306/my.cnf-- datadir=/u01/my3306/data-- user=mysql
13. Start mysql
[mysql@mysql bin] $. / mysqld_safe-- defaults-file=/u01/my3306/my.cnf-- user=mysql &
[1] 17237
[mysql@mysql bin] $170612 06:37:02 mysqld_safe Logging to'/ u01 mysqld_safe Logging to'/ my3306 ash.
170612 06:37:02 mysqld_safe Starting mysqld daemon with databases from / u01/my3306/data
[mysql@mysql bin] $mysql
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.6.36-log Source distribution
Copyright (c) 2000, 2017, 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 >
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | test |
+-+
4 rows in set (0.10 sec)
On how to carry out Mysql5.6 or Centos6.5 source code compilation and installation is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it 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.