MySql WorkBench 10060 连接时出错
Posted
技术标签:
【中文标题】MySql WorkBench 10060 连接时出错【英文标题】:MySql WorkBench 10060 error while connecting 【发布时间】:2019-11-11 22:43:43 【问题描述】:我在通过 mysql 工作台连接到我的 mysql 时遇到问题。当我创建连接并单击测试连接时,1-2分钟后它说: failed to connect to MySQL at xxx:3306 with user root. Lost connection to MySql server at 'waiting for initial communcation packet', system error: 10060 当我在几分钟后单击连接时,它会崩溃。
我在 ubuntu 18 服务器上运行 mysql 数据库。我没有其他防火墙,并且我已经使用“ufw disable”命令禁用了 ufw。 我还注释掉了配置文件中的绑定地址行。 整个配置文件如下:
# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run
program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log = 1
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
我还授予了 root 上的所有权限,如下所示:
grant all privileges on *.* to 'root'@'%' identified by 'xxx';
当我运行 netstat -plan| 时grep 3306 。我明白了:
tcp6 0 0 :::3306 :::* LISTEN 27233 /mysqld
这意味着服务器已准备好从远程 ip 监听。
【问题讨论】:
【参考方案1】:向所有用户授予权限,但这不是好的做法。
GRANT ALL ON .* TO ''@'%' IDENTIFIED BY 'yourdbpassword'; 刷新特权;
更多详情:https://dev.mysql.com/doc/refman/8.0/en/grant.html
【讨论】:
以上是关于MySql WorkBench 10060 连接时出错的主要内容,如果未能解决你的问题,请参考以下文章
通过mysql 连接远程数据库时,输入密码后,提示10060错误
连接到 Mysql AWS RDS 实例时工作台错误 10060
连接MySQL的10060错误:Can't connect to MySQL server on '*.*.*.*'(10060) (转自https://www.cnblo
centos下MySQL Workbench连接时崩溃的解决方法
连接mysql数据库时提示2003 can't connect to MySQL server on ip(10060)的解决办法