标签:环境 否则 key note host group isa cti bst
官方网站中下载源码包;
https://dev.mysql.com/downloads/mysql/
选择下载源码包:
由于官网下载较慢,我选择使用搜狐镜像站进项下载..速度真的快的不是一星半点:
电梯:
http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17.tar.gz
下载下来后计算一下md5和上图比对一下.不对就重新下载一次.不过一般都没有什么问题.
1 # useradd -s /sbin/nologin mysql
1 # tar zxf cmake-2.8.12.2.tar.gz 2 # cd cmake-2.8.12.2 3 # ./bootstrap --prefix=/usr/local/cmake 4 # make && make install 5 6 # echo ‘export PATH=$PATH:/usr/local/cmake/bin‘ >> /etc/profile 7 # source /etc/profile
根据官方文档提示,此过程比较消耗内存,同时也一定注意,从MySQL5.7版本开始,安装MySQL需要依赖 Boost 的C++扩展,而且只能是 1.59.0 版本;
Boost 下载地址: http://www.boost.org/users/history ;选择1.59.0版本下载,在编译是填写相应参数,指定Boost源码位置即可;
# wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz # tar zxf boost_1_59_0.tar.gz # mv boost_1_59_0 /usr/local/boots
# cd mysql-5.7.17 # bpath=‘/opt/mysql/mysql_5717‘ # cmake . -DCMAKE_INSTALL_PREFIX=${bpath} -DINSTALL_MYSQLDATADIR="${bpath}/var" -DMYSQL_DATADIR=${bpath}/var -DSYSCONFDIR=${bpath}/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=$bport -DMYSQL_UNIX_ADDR=${bpath}/tmp/mysql.sock -DWITH_EXTRA_CHARSETS=all -DWITH_BOOST=/usr/local/boots -DDOWNLOAD_BOOST=1 # make && make install # cd /opt/mysql/mysql_5717/
# mkdir {etc,log,tmp,var}
# chown mysql.mysql -R *
1 [mysql] 2 port=3306 3 default_character_set=utf8 4 no_auto_rehash 5 6 [client] 7 port = 3306 8 socket = /opt/mysql/mysql_5717/tmp/mysql.sock 9 loose_default_character_set = utf8 10 11 [mysqld] 12 ####dir 13 pid-file = /opt/mysql/mysql_5717/tmp/mysql.pid 14 socket = /opt/mysql/mysql_5717/tmp/mysql.sock 15 datadir = /opt/mysql/mysql_5717/data 16 tmpdir = /tmp 17 18 ####server 19 server_id = 503306 20 port=3306 21 max_connections=3000 22 max_user_connections=1000 23 character_set_server=utf8 24 default_time_zone = ‘+08:00‘ 25 secure_file_priv = NULL 26 sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER" 27 log_timestamps=system 28 transaction_write_set_extraction=MURMUR32 29 show_compatibility_56=on 30 31 default_storage_engine=INNODB 32 lower_case_table_names=1 33 auto_increment_increment = 1 34 auto_increment_offset = 1 35 log_bin_trust_function_creators=1 36 explicit_defaults_for_timestamp=1 37 38 skip_external_locking 39 skip_name_resolve 40 wait_timeout=180 41 interactive_timeout=180 42 max_connect_errors=1000 43 open_files_limit=65535 44 connect_timeout=8 45 net_read_timeout=30 46 net_write_timeout=60 47 back_log=500 48 49 ####slow log 50 long_query_time=1 51 slow_query_log=1 52 log_queries_not_using_indexes = 1 53 log_throttle_queries_not_using_indexes = 10 54 log_slow_admin_statements = 1 55 log_slow_slave_statements = 1 56 slow_query_log_file=/opt/mysql/mysql_5717/log/slowquery.log 57 58 ####general log 59 general_log=0 60 general_log_file=/opt/mysql/mysql_5717/log/general.log 61 62 ####error log 63 log_error=/opt/mysql/mysql_5717/log/mysql.err 64 65 ####query cache 66 query_cache_type=0 67 query_cache_size=0 68 query_cache_limit=2M 69 query_cache_min_res_unit=1K 70 71 table_open_cache = 65536 72 max_allowed_packet=32M 73 max_heap_table_size = 100M 74 tmp_table_size = 64M 75 thread_stack=512K 76 thread_cache_size=1024 77 read_rnd_buffer_size = 32M 78 sort_buffer_size = 32M 79 read_buffer_size = 32M 80 join_buffer_size = 128M 81 82 ####innodb 83 innodb_data_home_dir=/opt/mysql/mysql_5717/data 84 innodb_log_group_home_dir=/opt/mysql/mysql_5717/data 85 innodb_data_file_path=ibdata1:2G;ibdata2:16M:autoextend 86 innodb_buffer_pool_size=4G 87 innodb_buffer_pool_instances=4 88 innodb_log_files_in_group=2 89 innodb_log_file_size=1024M 90 innodb_log_buffer_size=10M 91 innodb_flush_log_at_trx_commit=2 92 innodb_max_dirty_pages_pct=60 93 innodb_thread_concurrency=32 94 innodb_read_io_threads=8 95 innodb_write_io_threads=8 96 innodb_open_files=60000 97 innodb_file_per_table=1 98 innodb_flush_method=O_DIRECT 99 innodb_support_xa = 1 100 innodb_lock_wait_timeout=10 101 innodb_page_size = 8192 102 innodb_buffer_pool_load_at_startup = 1 103 innodb_buffer_pool_dump_at_shutdown = 1 104 innodb_buffer_pool_dump_pct = 40 105 innodb_page_cleaners = 4 106 innodb_lock_wait_timeout = 5 107 innodb_undo_directory = /opt/mysql/mysql_5717/data/ 108 innodb_undo_logs = 128 109 innodb_undo_tablespaces = 3 110 innodb_undo_log_truncate = 1 111 innodb_max_undo_log_size = 2G 112 innodb_purge_rseg_truncate_frequency = 128 113 innodb_flush_neighbors = 1 114 115 ####myisam 116 key_buffer_size = 64M 117 myisam_sort_buffer_size=64M 118 119 ####gtid 120 gtid_mode=off 121 enforce_gtid_consistency=1 122 123 ####binlog 124 log_bin = mysql-bin 125 binlog_cache_size=4M 126 max_binlog_cache_size=2G 127 max_binlog_size=500M 128 binlog_format=ROW 129 #binlog_row_image=full 130 sync_binlog=1 131 log_slave_updates=1 132 expire_logs_days=60 133 134 ####replication 135 relay_log_recovery=1 136 relay_log_purge = 1 137 relay_log= relaylog 138 read_only = 1 139 skip_slave_start 140 slave_net_timeout=30 141 #slave_parallel_workers = 4 142 #master_info_repository = TABLE 143 #relay_log_info_repository = TABLE 144 #binlog_gtid_simple_recovery = 1 145 #slave_skip_errors = ddl_exist_errors 146 147 [mysqldump] 148 quick 149 max_allowed_packet = 32M 150 151 [myisamchk] 152 key_buffer_size = 256M 153 sort_buffer_size = 256M 154 read_buffer = 2M 155 write_buffer = 2M 156 157 [mysqlhotcopy] 158 interactive_timeout
附上my.cnf,此文件存在$bpath/etc/下.
因此要把/etc/my.cnf删除.否则默认读/etc/my.cnf
配置文件中的参数不是通用.需要配合环境调整.
初始化mysql,mysql的初始密码存在mysql.err里
1 创建安装目录和数据存放目录,并修改权限 2 # bin/mysqld --defaults-file=etc/my.cnf --initialize --user=mysql 3 # cat /opt/mysql/mysql_5717/log/mysql.err |grep ‘A temporary password ‘ 4 2017-03-28T15:38:58.385432+08:00 1 [Note] A temporary password is generated for root@localhost: /0sgQgr3ADg* 5 6 这个是临时密码..一定要记住.
1 cd $bpath 2 ./bin/mysql.server restart 3 4 也可以把mysql.server拷贝到/etc/init.d下 使用service来启动 5 cp support-files/mysql.server /etc/init.d/mysqld 6 /etc/init.d/mysqld start
1 # ./bin/mysql -u root -p 2 3 修改root密码,否则无法操作 4 mysql> ALTER USER root@localhost IDENTIFIED BY ‘‘123456";
标签:环境 否则 key note host group isa cti bst
原文地址:http://www.cnblogs.com/wayde-Z/p/6636044.html