网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

mysql5.7单实例安装

yum -y install cmake

useradd MySQL

cmake \
-DCMAKE_INSTALL_PREFIX=/u01/mysql \
-DMYSQL_DATADIR=/u01/mysql/data \
-DSYSCONFDIR=/u01/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_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=utf8 \
-DDEFAULT_COLLATION=utf8_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

/*
随机生成的密码:
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目标目录下不能有数据文件
*/

//备份my.conf文件
mv /etc/my.cnf /etc/my.cnf.bak


[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 = /u01/mysql/data/mysql.sock

[mysql]
no-auto-rehash

[mysqld]
server-id = 1
user = mysql
port = 3306
socket = /u01/mysql/data/mysql.sock
basedir = /u01/mysql
datadir = /u01/mysql/data
open_files_limit    = 10240

back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_open_cache = 614
external-locking = FALSE
max_allowed_packet = 32M  
thread_cache_size = 300
query_cache_size = 64M
query_cache_limit = 4M
default-storage-engine = InnoDB
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 256M
max_heap_table_size = 256M
long_query_time = 4

slow_query_log_file=/u01/mysql/data/slow-log.log
slow_query_log
log-bin = /u01/mysql/data/ray-bin.log
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 256MB
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
skip-name-resolve
lower_case_table_names = 1

innodb_buffer_pool_size = 512M
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on

[mysqldump]
quick
max_allowed_packet = 32M

[mysqld_safe]
log-error=/u01/mysql/data/mysql_ray.err
pid-file=/u01/mysql/data/ray.pid


[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)




本文名称:mysql5.7单实例安装
标题路径:http://bjjierui.cn/article/jccoeo.html

其他资讯