Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';不能通过tcp/ip连接到mysql,但可以通过套接字连接_Mysql_Linux - Fatal编程技术网

Can';不能通过tcp/ip连接到mysql,但可以通过套接字连接

Can';不能通过tcp/ip连接到mysql,但可以通过套接字连接,mysql,linux,Mysql,Linux,系统:CentOS 7.3.1611 MySQL:5.6.47 它类似于--跳过网络选项。但是在my.cnf中没有跳过网络 使用ps aux | grep mysql可以找到mysql服务 netstat-talnp | grep3306和lsof-i:3306都不返回任何内容 使用mysql-uroot-h127.0.0.1-p将返回无法连接到'127.0.0.1'(111)上的mysql服务器,但mysql-uroot-hlocalhost-p可以访问 my.cnf [client] #pa

系统:CentOS 7.3.1611

MySQL:5.6.47

它类似于--跳过网络选项。但是在my.cnf中没有跳过网络

  • 使用ps aux | grep mysql可以找到mysql服务
  • netstat-talnp | grep3306和
    lsof-i:3306都不返回任何内容
  • 使用
    mysql-uroot-h127.0.0.1-p
    将返回
    无法连接到'127.0.0.1'(111)
    上的mysql服务器,但
    mysql-uroot-hlocalhost-p
    可以访问
  • my.cnf

    [client]
    #password   = your_password
    port        = 3306
    socket      = /tmp/mysql.sock
    bind-address = 0.0.0.0
    
    [mysqld]
    port        = 3366
    socket      = /tmp/mysql.sock
    datadir = /www/server/data
    default_storage_engine = InnoDB
    performance_schema_max_table_instances = 400
    table_definition_cache = 400
    skip-external-locking
    key_buffer_size = 32M
    max_allowed_packet = 100G
    table_open_cache = 128
    sort_buffer_size = 768K
    net_buffer_length = 4K
    read_buffer_size = 768K
    read_rnd_buffer_size = 256K
    myisam_sort_buffer_size = 8M
    thread_cache_size = 16
    query_cache_size = 16M
    tmp_table_size = 32M
    sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    local-infile=0
    skip_symbolic_links=yes
    
    explicit_defaults_for_timestamp = true
    #skip-name-resolve
    max_connections = 500
    max_connect_errors = 100
    open_files_limit = 65535
    
    log-bin=mysql-bin
    binlog_format=mixed
    server-id = 1
    expire_logs_days = 10
    slow_query_log=1
    slow-query-log-file=/www/server/data/mysql-slow.log
    long_query_time=3
    #log_queries_not_using_indexes=on
    
    
    innodb_data_home_dir = /www/server/data
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_log_group_home_dir = /www/server/data
    innodb_buffer_pool_size = 128M
    innodb_log_file_size = 64M
    innodb_log_buffer_size = 16M
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 50
    innodb_max_dirty_pages_pct = 90
    innodb_read_io_threads = 1
    innodb_write_io_threads = 1
    
    [mysqldump]
    quick
    max_allowed_packet = 500M
    
    [mysql]
    no-auto-rehash
    
    [myisamchk]
    key_buffer_size = 32M
    sort_buffer_size = 768K
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    
    
    错误页

    Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    
    错误日志

    2020-02-25 17:30:26 7117 [Note] Plugin 'FEDERATED' is disabled.
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2020-02-25 17:30:26 7117 [Note] InnoDB: The InnoDB memory heap is disabled
    2020-02-25 17:30:26 7117 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2020-02-25 17:30:26 7117 [Note] InnoDB: Memory barrier is not used
    2020-02-25 17:30:26 7117 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using Linux native AIO
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using CPU crc32 instructions
    2020-02-25 17:30:26 7117 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2020-02-25 17:30:26 7117 [Note] InnoDB: Completed initialization of buffer pool
    2020-02-25 17:30:26 7117 [Note] InnoDB: Highest supported file format is Barracuda.
    2020-02-25 17:30:26 7117 [Note] InnoDB: 128 rollback segment(s) are active.
    2020-02-25 17:30:26 7117 [Note] InnoDB: Waiting for purge to start
    2020-02-25 17:30:27 7117 [Note] InnoDB: 5.6.47 started; log sequence number 7634069
    2020-02-25 17:30:27 7117 [Note] RSA private key file not found: /www/server/data//private_key.pem. Some authentication plugins will not work.
    2020-02-25 17:30:27 7117 [Note] RSA public key file not found: /www/server/data//public_key.pem. Some authentication plugins will not work.
    2020-02-25 17:30:27 7117 [Note] Server hostname (bind-address): '*'; port: 3366
    2020-02-25 17:30:27 7117 [Note] IPv6 is available.
    2020-02-25 17:30:27 7117 [Note]   - '::' resolves to '::';
    2020-02-25 17:30:27 7117 [Note] Server socket created on IP: '::'.
    2020-02-25 17:30:27 7117 [Note] Event Scheduler: Loaded 0 events
    2020-02-25 17:30:27 7117 [Note] /www/server/mysql/bin/mysqld: ready for connections.
    
    

    您已将
    端口设置为3366,但您正在尝试通过默认端口3306进行连接。使用mysql-H127.0.0.1-P3366…
    指定您正在使用的端口


    您仍在使用默认的unix域套接字路径
    /tmp/mysql.sock
    ,因此通过该方法进行连接时无需额外选项。

    是否有理由将innodb_读取_io_线程和innodb_写入_io_线程限制为1?补充资料要求。RAM大小、#内核、MySQL主机服务器上的任何SSD或NVME设备?在pastebin.com上发布并共享链接。从SSH登录根目录中,文本结果为:B)显示全局状态;至少24小时正常运行后C)显示全局变量;D) 显示完整的进程列表;E) 完成服务器工作负载优化分析的MySQLTuner报告以提供建议。
    2020-02-25 17:30:26 7117 [Note] Plugin 'FEDERATED' is disabled.
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2020-02-25 17:30:26 7117 [Note] InnoDB: The InnoDB memory heap is disabled
    2020-02-25 17:30:26 7117 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2020-02-25 17:30:26 7117 [Note] InnoDB: Memory barrier is not used
    2020-02-25 17:30:26 7117 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using Linux native AIO
    2020-02-25 17:30:26 7117 [Note] InnoDB: Using CPU crc32 instructions
    2020-02-25 17:30:26 7117 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2020-02-25 17:30:26 7117 [Note] InnoDB: Completed initialization of buffer pool
    2020-02-25 17:30:26 7117 [Note] InnoDB: Highest supported file format is Barracuda.
    2020-02-25 17:30:26 7117 [Note] InnoDB: 128 rollback segment(s) are active.
    2020-02-25 17:30:26 7117 [Note] InnoDB: Waiting for purge to start
    2020-02-25 17:30:27 7117 [Note] InnoDB: 5.6.47 started; log sequence number 7634069
    2020-02-25 17:30:27 7117 [Note] RSA private key file not found: /www/server/data//private_key.pem. Some authentication plugins will not work.
    2020-02-25 17:30:27 7117 [Note] RSA public key file not found: /www/server/data//public_key.pem. Some authentication plugins will not work.
    2020-02-25 17:30:27 7117 [Note] Server hostname (bind-address): '*'; port: 3366
    2020-02-25 17:30:27 7117 [Note] IPv6 is available.
    2020-02-25 17:30:27 7117 [Note]   - '::' resolves to '::';
    2020-02-25 17:30:27 7117 [Note] Server socket created on IP: '::'.
    2020-02-25 17:30:27 7117 [Note] Event Scheduler: Loaded 0 events
    2020-02-25 17:30:27 7117 [Note] /www/server/mysql/bin/mysqld: ready for connections.