189 8069 5689

mysql-5.7二进制安装-创新互联

1.解压安装包:

10多年的鸡西网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整鸡西建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“鸡西网站设计”,“鸡西网站推广”以来,每个客户项目都认真落实执行。

tar -zxvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

创建mysql目录:

mkdir -p /data/mysql
cd /data/mysql/

binlog存储目录:

mkdir binlog

mysql数据目录:

mkdir data

mysql日志目录:

mkdir log

限制mysql导入导出目录:

mkdir tmp

授权mysql用户:

chown -R mysql:mysql /data/mysql/

移动目录到自定义的位置,这里存放位置为/usr/local下:

mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/mysql

cd /usr/local/

程序目录授权:

chown -R mysql:mysql /usr/local/mysql/

备份自带的配置文件:

cp my.cnf my.cnf.back

编辑新的配置文件:

vi my.cnf

将以下内容替换源文件的内容

[mysqld]
#bind-address 0.0.0.0
back_log = 2000
basedir = /usr/local/mysql
character-set-server = utf8mb4
datadir = /data/mysql/data
event_scheduler = ON
innodb_autoinc_lock_mode = 1
innodb_buffer_pool_size = 16G
innodb_data_file_path = ibdata1:500M:autoextend
innodb_data_home_dir = /data/mysql/data
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_io_capacity = 2000
innodb_log_buffer_size = 8388608
innodb_log_files_in_group = 3
innodb_log_group_home_dir = /data/mysql/data
innodb_max_dirty_pages_pct = 50
innodb_open_files = 1024
innodb_read_io_threads = 8
innodb_thread_concurrency = 20
innodb_write_io_threads = 8
innodb_lock_wait_timeout = 10
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
key_buffer_size = 3221225472
innodb_log_file_size = 1G
local_infile = 1
slave-skip-errors = 1062 1032
binlog-format = row
log-bin = /data/mysql/binlog/mysql-bin.log
expire_logs_days = 7

log_bin_trust_function_creators = 1
log_output = FILE
long_query_time = 1
log-error = /data/mysql/log/error.log
max_allowed_packet = 134217728
max_connect_errors = 1000000
max_connections = 2000
myisam_sort_buffer_size = 33554432
#myisam_recover = 1
join_buffer_size = 8388608
tmp_table_size = 33554432
net_buffer_length = 8192
performance_schema = 1
performance_schema_max_table_instances = 200
pid-file = /data/mysql/mysqld.pid
port = 3306
query_cache_size = 0
query_cache_type = 0
read_buffer_size = 20971520
read_rnd_buffer_size = 16M
max_heap_table_size = 33554432
bulk_insert_buffer_size = 134217728
#relay-log = /data2/mysql/log/mysql-relay.log
secure-file-priv = /data/mysql/tmp
server-id = 324532432
skip-slave-start
skip_name_resolve
slave-load-tmpdir = /data/mysql/tmp
slow-query-log-file = /data/mysql/log/mysql-slow.log
slow_query_log = 1
socket = /tmp/mysql.sock
sort_buffer_size = 2097152

table_open_cache = 128
thread_cache_size = 50
tmpdir = /data/mysql/tmp
user = mysql
#wait_timeout = 2880000
transaction_isolation=read-committed
long_query_time=1
sync_binlog=0
innodb_flush_log_at_trx_commit=0
[mysqld_safe]
log-error = /data/mysql/log/error.log
pid-file = /data/mysql/mysqld.pid

保存退出

cd /usr/local/mysql/

初始化数据库:

./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/data/

cd /data/mysql/log/

查看日志,初始化会生成初始密码:

tail -f error.log

拷贝启动脚本到系统启动目录:

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

加入开机启动服务:

chkconfig --add mysql

设置开机启动:

chkconfig mysql on

拷贝命令到系统路径下,便于全局调用:

cp /usr/local/mysql/bin/* /usr/local/sbin/

/etc/init.d/mysql start ##启动数据库

登录到数据库内修改root用户的初始化密码:

mysql -u root -p --->输入mysql数据库root用户的密码
SET PASSWORD = PASSWORD('新密码'); ##修改root用户的密码。(alter user user() identified by '新密码';)

到这里整个初始化过程就完成了。

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页题目:mysql-5.7二进制安装-创新互联
当前路径:http://cdxtjz.cn/article/dspgod.html

其他资讯