mysql 5.7單例項安裝
boost下載地址:
mkdir /usr/local/mysql/boost -p [root@localhost ~]# cp boost_1_59_0/* /usr/local/mysql/boost/ -r yum -y install cmake yum -y install gcc* yum -y install ncurses-devel yum -y install gcc-c++ ncurses ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison openssl-devel useradd mysql cmake \ -DCMAKE_INSTALL_PREFIX=/u01/mysql \ -DMYSQL_DATADIR=/u01/mysql/data \ -DSYSCONFDIR=/u01/mysql/data \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DMYSQL_TCP_PORT=3306 \ -DMYSQL_USER=mysql \ -DMYSQL_UNIX_ADDR=/u01/mysql/data/mysql.sock \ -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/u01/mysql/boost 或者預設路徑安裝 cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DMYSQL_TCP_PORT=3306 \ -DMYSQL_USER=mysql \ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/usr/local/mysql/boost
make && make install
//初始化mysql資料庫
/u01/mysql/bin/mysqld --initialize --user=mysql --basedir=/u01/mysql --datadir=/u01/mysql/data --innodb_undo_tablespaces=4 --explicit_defaults_for_timestamp
/*
隨機生成的密碼:
2016-11-24T09:59:53.588280Z 1 [Note] A temporary password is generated for root@localhost: yuWx:rLGp2xj
之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目錄下,且已被廢棄
“–initialize”會生成一個隨機密碼(~/.mysql_secret),而”–initialize-insecure”不會生成密碼
–datadir目標目錄下不能有資料檔案
*/
[root@CnBJYwz01QorasunpengL01 mysql-5.7.10]# cp /u01/mysql/support-files/mysql.server /etc/init.d/mysqld [root@CnBJYwz01QorasunpengL01 mysql-5.7.10]# chmod +x /etc/init.d/mysqld
//配置my.cnf
[root@CnBJYwz01QorasunpengL01 mysql-5.7.10]# vi /u01/mysql/my.cnf [client] port = 3306 socket = /var/lib/mysql/mysql.sock [mysql] no-auto-rehash [mysqld] server-id = 1 user = mysql port = 3306 socket = /var/lib/mysql/mysql.sock basedir = /usr/local/mysql datadir = /usr/local/mysql/data character_set_server = utf8mb4 explicit_defaults_for_timestamp = true #connect options back_log = 100 #requests can be stored on the stack for a short time before MySQL temporarily stops answering new requests max_connections = 1000 max_connect_errors = 10 #number which allow to connect server for error password connect_timeout=20 #The number of seconds that the mysqld server waits for a connect packet max_allowed_packet = 16M ### Table Cache Settings table_open_cache = 1024 ## Range: 64~ 524288,default 64.The recommendation is the same as MAX_CONNECTION or slightly larger than MAX_CONNECTION. open_files_limit = 5000 ##using the bigger value-- max_connections*5 or ulimited -n tmp_table_size = 64M #default 16M,recomendation 64-256M max_heap_table_size = 128M ### Per-Thread Buffers sort_buffer_size = 2M #read_buffer_size = 2M #read_rnd_buffer_size = 16M #bulk_insert_buffer_size = 64M #join_buffer_size = 2M thread_stack = 512K #slow log slow_query_log_file = /usr/local/mysql/data/slow-log.log slow_query_log=1 log_queries_not_using_indexes = 1 log_throttle_queries_not_using_indexes = 5 log_slow_slave_statements = 1 long_query_time = 3 min_examined_row_limit = 100 ##bin log log-bin = /usr/local/mysql/data/log-bin.log binlog_cache_size = 1M #max_binlog_size = 4GG expire_logs_days = 7 binlog_format = ROW #binlog_stmt_cache_size = 10M #key_buffer_size = 256MB lower_case_table_names = 1 #slave log option log_slave_updates relay_log_recovery = 1 slave_skip_errors = ddl_exist_errors #一般設定物理儲存的60% ~ 70% innodb_buffer_pool_size = 1G ###innodb options #innodb_buffer_pool_instances = 4 innodb_file_per_table = on #innodb_read_io_threads = 8 ##default 4, #innodb_write_io_threads = 8 autocommit = 0 #turn off auto commit innodb_flush_method = O_DIRECT ##innodb memery innodb_buffer_pool_size = 512M #70%-80% of momery #innodb_max_dirty_pages_pct = 70 #innodb_lock_wait_timeout = 120 ##redo log #設定redoLog檔案所在目錄, redoLog記錄事務具體操作內容 innodb_log_group_home_dir = /usr/local/mysql/data/ innodb_log_buffer_size = 16M #default 8M, 16-64M is better innodb_log_file_size = 256M innodb_log_files_in_group = 4 innodb_flush_log_at_trx_commit = 2 sync_binlog = 1 #set independent undo innodb_undo_directory = /usr/local/mysql/data innodb_undo_logs = 128 innodb_undo_tablespaces = 4 innodb_max_undo_log_size = 1G #innodb_purge_rseg_truncate_frequency = 128 #default 128 innodb_undo_log_truncate = 1 [ysqldump] quick max_allowed_packet = 32M [mysqld_safe] log-error=/usr/local/mysql/data/mysql.err pid-file=/usr/local/mysql/data/mysql.pid
vi /lib/systemd/system/mysqld.service
[Unit] Description=MySQL Server Documentation=man:mysqld(8) Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql Type=forking # Start main service ExecStart=/usr/local/mysql/support-files/mysql.server start #ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf # Stop main service ExecStop=/usr/local/mysql/support-files/mysql.server stop LimitNOFILE = 5000
[mysql@CnBJYwz01QorasunpengL01 mysql]$ service mysqld start Starting MySQL.. [ OK ] //重置密碼 [mysql@CnBJYwz01QorasunpengL01 ~]$ mysql -uroot -pyuWx:rLGp2xj mysql> set password = password('123456'); Query OK, 0 rows affected, 1 warning (0.01 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28572479/viewspace-2132709/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql 5.7 多例項安裝MySql
- 5.6單例項安裝單例
- Redis單例項安裝Redis單例
- mysql-5.6.31安裝(單例項 Linux)MySql單例Linux
- Docker 安裝 Mysql 5.7DockerMySql
- oracle單例項12.2.0.1安裝Oracle單例
- 安裝Mongodb3.0.6單例項MongoDB單例
- CentOS 7 - 安裝MySQL 5.7CentOSMySql
- CentOS 7 安裝 MySQL 5.7CentOSMySql
- mysql5.7 安裝教程MySql
- centos安裝mysql5.7CentOSMySql
- oracle 11g 單例項安裝Oracle單例
- Windows安裝MySQL5.7教程WindowsMySql
- Linux下安裝MySQL 5.7LinuxMySql
- Linux 7 安裝Mysql 5.7LinuxMySql
- CentOS 6.5/6.6 安裝mysql 5.7CentOSMySql
- MySQL 5.7安裝部署總結MySql
- 用OneinStack安裝mysql 5.7MySql
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- mysqld_multi安裝多個mysql例項MySql
- debian-mysql5.7安裝與解除安裝MySql
- Mysql 5.7 免安裝版windows安裝完整教程MySqlWindows
- 單機環境安裝配置ASM例項ASM
- CentOS7.3 安裝 MySQL5.7CentOSMySql
- Ubuntu 18.04 安裝配置 MySQL 5.7UbuntuMySql
- CentOS7 安裝mysql5.7CentOSMySql
- mysql5.7tar包的安裝MySql
- macOS Mojave 降級安裝 MySQL 5.7MacMySql
- MySQL5.7綠色版安裝MySql
- 如何在debain上安裝mysql 5.7AIMySql
- mysql5.7安裝_centos7MySqlCentOS
- ubuntu16 安裝mysql5.7UbuntuMySql
- windows安裝及配置mysql5.7WindowsMySql
- mysql5.7GeleraCluster安裝部署(二)MySql
- Ubuntu 16.04 上安裝 MySQL 5.7UbuntuMySql
- windows同時安裝 5.7 8.0 mysqlWindowsMySql
- [Mysql] 1.Mysql 5.7 綠色安裝(windows)MySqlWindows
- 19C 單例項資料庫安裝單例資料庫