6

记录一次服务器搭建MySQL

 2 years ago
source link: https://wendaoit.github.io/2021/11/12/20211112-%E8%AE%B0%E5%BD%95%E4%B8%80%E6%AC%A1%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BAMySQL/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

记录一次服务器搭建MySQL | 问道IT

技术坑:Linux centos7 mysql navicate docker

Centos7 系统安装 docker,并配置阿里云镜像加速器

先在服务器上安装一个docker 根据官方文档

​ docker pull MySQL:8.0

whereis mysql 查看安装位置

通过下面命令创建一个镜像

docker ps -a查看是否启动成功

启动成功 改配置文件

cd /mydata/mysql/confvi my.cnf

配置文件参考

  1. ```
    [mysqld]
    ####: for global
    user =mysql
    federated
    basedir =/usr/local/mysql
    datadir =/data/mysql/data
    server_id = 1250
    port =3306
    mysqlx_port = 33070
    character_set_server =utf8mb4
    collation_server=utf8mb4_bin
    log_timestamps =system
    default_time_zone =’+8:00’
    socket =/data/mysql/mysql.sock
    read_only = 0
    super_read_only = 0
    skip_name_resolve =on
    lower_case_table_names =1
    #secure_file_priv =/data/mysql/data
    open_files_limit =65536
    max_connections =2000
    thread_cache_size =256
    table_open_cache =4096 # 2000
    table_definition_cache =4096
    table_open_cache_instances =64
    wait_timeout =28800
    interactive_timeout =28800
    event_scheduler = 1
    max_allowed_packet =1024M
    init_connect =’SET AUTOCOMMIT=1’
    transaction_isolation =READ-COMMITTED
    lock_wait_timeout=3600
    default_authentication_plugin=mysql_native_password###: cache
    key_buffer_size = 64M
    sort_buffer_size = 4M
    join_buffer_size = 4M####: for binlog
    binlog_format =row
    log_bin =/data/mysql/logs/mysql-bin
    binlog_rows_query_log_events =off
    log_slave_updates =on
    #expire_logs_days =7
    binlog_expire_logs_seconds=604800
    binlog_cache_size =1G
    max_binlog_size =1G
    binlog_checksum =none
    sync_binlog =1
    slave-preserve-commit-order =ON
    log_bin_trust_function_creators=on ####:for error-log
    log_error =/data/mysql/logs/mysql.err
    general_log =off
    general_log_file =/data/mysql/logs/general.log####: for slow query log
    slow_query_log =on
    slow_query_log_file =/data/mysql/logs/slowquery.log
    long_query_time =1.000000
    log_queries_not_using_indexes =0####: for gtid
    #gtid_executed_compression_period =1000
    gtid_mode =on
    enforce_gtid_consistency =on####: for replication
    relay-log-index = /data/mysql/logs/relay-bin.index
    relay-log-info-file = /data/mysql/logs/relay-log.info
    relay-log = /data/mysql/logs/relay-bin
    log-slave-updates =1
    skip_slave_start =1
    master_info_repository =table
    relay_log_info_repository =table
    slave_parallel_type =logical_clock
    slave_parallel_workers =2####: for performance_schema
    performance_schema = 1
    performance_schema_instrument = ‘%memory%=on’
    performance_schema_instrument = ‘%lock%=on’
    performance_schema_digests_size =100000####: for innodb
    innodb_data_file_path =ibdata1:1024M:autoextend
    innodb_temp_data_file_path =ibtmp1:12M:autoextend
    innodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_pool
    innodb_log_files_in_group =3
    innodb_log_file_size =256M # 50331648(48M)
    innodb_max_undo_log_size =256M
    innodb_undo_log_truncate =1
    innodb_undo_tablespaces =2
    innodb_file_per_table =on
    innodb_open_files =65535
    innodb_thread_concurrency =0 # 0
    innodb_read_io_threads =2
    innodb_write_io_threads =2
    innodb_purge_threads =1
    innodb_page_cleaners =1
    innodb_print_all_deadlocks =off
    innodb_lock_wait_timeout =20
    innodb_autoinc_lock_mode =2
    innodb_io_capacity =500
    innodb_io_capacity_max =1000#########################
    innodb_flush_method =O_DIRECT
    innodb_log_buffer_size =128M
    innodb_flush_log_at_trx_commit =1
    innodb_buffer_pool_size = 128M
    innodb_buffer_pool_instances = 2
    #innodb_numa_interleave=on
    #####################################
    #######################
    [client]
    socket=/data/mysql/mysql.sock
    7. docker restart 容器ID

    测试连接

    #### MySQL允许远程连接

    项目中需要连接虚拟机上面的 MySQL 数据库,但是总是出错,怀疑本机是否有连接远程数据库的权限。

    执行命令:

    ```sql
    mysql> use mysql;
    mysql> select host,user from user;

Recommend

  • 55

    背景介绍客户目前使用的是ExchangeServer2013,两前两后,数据盘是存储挂载过来的,邮件备份使用的是NBU,由于机房漏水,导致存储服务器宕机。导致绝大部分数据丢失。Exchange恢复过程使用新存储重新划分磁盘,并使用NBU逐个恢复数据库,按照原路径恢复。检查已恢复...

  • 16

    背景 我司的软件在一个客户处测试功能和性能,这个客户比较特殊: 他们客户端是很旧的java代码,且要求不能改动,客户端的主要业务简单说就是上传下载文件 他们提供了客户端demo,http请求是用裸...

  • 11

    0×1   基本情况 偶然发现一台web服务器很怪异,其网站页面上增加了一堆外文的页面链接,点击一篇进去之后,内容如下图所示:

  • 15
    • zhuanlan.zhihu.com 3 years ago
    • Cache

    记录一次Linux服务器数据恢复过程

    记录一次Linux服务器数据恢复过程北亚专业服务器数据恢复/存储/虚拟化/数据库数据恢复

  • 3

    记录一次服务器重启应用恢复过程 副标题:哎呀,服务器登录不进去了瞎折腾 梳理服务器错误操作的整个过程,算是自己的一次复盘 ✍...

  • 5

    一. 问题描述 前两天在帮朋友在CentOS 8.5 安装了最新的MySQL 8.0.27,安装方式为编译安装。 才刚上线2天,就发现CPU长期负载100%,而且不管是高峰期还是低峰期,都是100%。 通过FinalShell查看:

  • 4

    受制于疫情的影响,有些人不能到公司进行测试,只能把测试环境部署在自己电脑上,由于自己的电脑充满了各种意想不到的情况,所以,在这里,我记录一下非常具有参考意义的一次经历。 由于这次的焦灼点主要是 mysql 的安装,所以,这里主讲

  • 4

    记录一次服务器被攻击时的处理过程 - 运维那点事 | 血衫非弧の一存

  • 4
    • blog.51cto.com 1 year ago
    • Cache

    25-mysql服务器集群搭建

    25-mysql服务器集群搭建_懒喵逼逼叨的技术博客_51CTO博客25-mysql集群搭建【高可用将会在26章发出】主从架构和原理MySQL的主从复制

  • 6

    首页技术宅Replit 免费搭建云服务器PHP+MySQL网站Replit 免费搭建云服务器PHP+MySQL网站

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK