mysql工作台可以';t远程连接到ubuntu服务器上的mysql数据库

mysql工作台可以';t远程连接到ubuntu服务器上的mysql数据库,mysql,mysql-workbench,ubuntu-server,Mysql,Mysql Workbench,Ubuntu Server,我有一个mysql服务器在ubuntu服务器上运行。我已经用mysql workbench远程连接它好几个月了。我最近重新启动了我的ubuntu服务器,之后我现在无法使用mysql工作台远程连接到mysql数据库。在ssh进入ubuntu服务器后,我仍然可以用同一个用户在本地登录mysql数据库。我正在尝试按照下面链接中的故障排除步骤进行操作。有人知道问题可能是什么吗 以下步骤如下: 看起来防火墙已经有了mysql的规则 sudo ufw status [sudo] password for

我有一个mysql服务器在ubuntu服务器上运行。我已经用mysql workbench远程连接它好几个月了。我最近重新启动了我的ubuntu服务器,之后我现在无法使用mysql工作台远程连接到mysql数据库。在ssh进入ubuntu服务器后,我仍然可以用同一个用户在本地登录mysql数据库。我正在尝试按照下面链接中的故障排除步骤进行操作。有人知道问题可能是什么吗

以下步骤如下:

看起来防火墙已经有了mysql的规则

sudo ufw status
[sudo] password for scotsditch: 
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
3306                       ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
3306 (v6)                  ALLOW       Anywhere (v6) 
找不到绑定地址

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf


# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
更新:

sudo mysqldump --all-databases > dump_042021.sql

mysqldump: Error: 'The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (1449)
sudo mysqld --upgrade=FORCE

2021-04-21T15:25:00.312253Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 10803
2021-04-21T15:25:00.313486Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-04-21T15:25:00.313520Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-04-21T15:25:00.313620Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.
select host,user,grant_priv,super_priv from mysql.user;

+-----------+------------------+------------+------------+
| host      | user             | grant_priv | super_priv |
+-----------+------------------+------------+------------+
| localhost | root             | Y          | Y          |
| localhost | mysql.session    | N          | Y          |
| localhost | mysql.sys        | N          | N          |
| localhost | debian-sys-maint | Y          | Y          |
| %         | user2            | N          | N          |
| %         | user1            | N          | N          |
| 0.0.0.0   | user1            | N          | N          |
| %         | user3            | N          | N          |
+-----------+------------------+------------+------------+



mysqldump -u user1 -p --all-databases > dump_042121.sql

Enter password: 
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': Access denied for user 'user1'@'%' (using password: YES) (1045)
mysql工作台错误:

Your connection attempt failed for user 'user' to the MySQL server at xxx.xxx.xx.xxx:3306:
  Access denied for user 'user'@'%%' (using password: YES)

Please:
1 Check that MySQL is running on address xxx.xxx.xx.xxx
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the user user has rights to connect to xxx.xxx.xx.xxx from your address (MySQL rights define what clients can connect to the server and from which machines) 
4 Make sure you are both providing a password if needed and using the correct password for xxx.xxx.xx.xxx connecting from the host address you're connecting from
更新:

sudo mysqldump --all-databases > dump_042021.sql

mysqldump: Error: 'The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (1449)
sudo mysqld --upgrade=FORCE

2021-04-21T15:25:00.312253Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 10803
2021-04-21T15:25:00.313486Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-04-21T15:25:00.313520Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-04-21T15:25:00.313620Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.
select host,user,grant_priv,super_priv from mysql.user;

+-----------+------------------+------------+------------+
| host      | user             | grant_priv | super_priv |
+-----------+------------------+------------+------------+
| localhost | root             | Y          | Y          |
| localhost | mysql.session    | N          | Y          |
| localhost | mysql.sys        | N          | N          |
| localhost | debian-sys-maint | Y          | Y          |
| %         | user2            | N          | N          |
| %         | user1            | N          | N          |
| 0.0.0.0   | user1            | N          | N          |
| %         | user3            | N          | N          |
+-----------+------------------+------------+------------+



mysqldump -u user1 -p --all-databases > dump_042121.sql

Enter password: 
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': Access denied for user 'user1'@'%' (using password: YES) (1045)
更新:

sudo mysqldump --all-databases > dump_042021.sql

mysqldump: Error: 'The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (1449)
sudo mysqld --upgrade=FORCE

2021-04-21T15:25:00.312253Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 10803
2021-04-21T15:25:00.313486Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-04-21T15:25:00.313520Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-04-21T15:25:00.313620Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.
select host,user,grant_priv,super_priv from mysql.user;

+-----------+------------------+------------+------------+
| host      | user             | grant_priv | super_priv |
+-----------+------------------+------------+------------+
| localhost | root             | Y          | Y          |
| localhost | mysql.session    | N          | Y          |
| localhost | mysql.sys        | N          | N          |
| localhost | debian-sys-maint | Y          | Y          |
| %         | user2            | N          | N          |
| %         | user1            | N          | N          |
| 0.0.0.0   | user1            | N          | N          |
| %         | user3            | N          | N          |
+-----------+------------------+------------+------------+



mysqldump -u user1 -p --all-databases > dump_042121.sql

Enter password: 
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': Access denied for user 'user1'@'%' (using password: YES) (1045)
更新:

sudo mysqldump --all-databases > dump_042021.sql

mysqldump: Error: 'The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (1449)
sudo mysqld --upgrade=FORCE

2021-04-21T15:25:00.312253Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 10803
2021-04-21T15:25:00.313486Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-04-21T15:25:00.313520Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-04-21T15:25:00.313620Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.
select host,user,grant_priv,super_priv from mysql.user;

+-----------+------------------+------------+------------+
| host      | user             | grant_priv | super_priv |
+-----------+------------------+------------+------------+
| localhost | root             | Y          | Y          |
| localhost | mysql.session    | N          | Y          |
| localhost | mysql.sys        | N          | N          |
| localhost | debian-sys-maint | Y          | Y          |
| %         | user2            | N          | N          |
| %         | user1            | N          | N          |
| 0.0.0.0   | user1            | N          | N          |
| %         | user3            | N          | N          |
+-----------+------------------+------------+------------+



mysqldump -u user1 -p --all-databases > dump_042121.sql

Enter password: 
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
mysqldump: Couldn't execute 'SHOW DATABASES': Access denied for user 'user1'@'%' (using password: YES) (1045)

当您尝试测试连接时,MySQL Workbench是否显示任何错误?@BillKarwin感谢您就此回复我。我添加了一个更新,在尝试使用mysql workbench连接“用户”时出错。我可以用ssh连接这个用户,然后登录到mysql并查询数据库,没有问题。这似乎只是远程连接时的问题,也是ubuntu重新启动后的问题。错误消息显示它正在访问MySQL服务器(没有防火墙阻止它),但它无法验证您提供的用户和密码。请注意,在MySQL中,从本地主机访问的用户(如ssh到服务器时)与从远程主机访问的用户不同。他们可能有不同的密码和权限。@BillKarwin我试图备份数据库mysqldump,但出现了一个错误。我在上面添加了它作为更新。我在谷歌上搜索了这个错误,发现了一个似乎相关的SO帖子:我以前升级过mysql版本,这可能是问题所在吗?如果是这样,我是否需要运行“docker exec-it mysql bash”一文中提到的与docker相关的命令?我不知道我可能在docker映像上运行mysql,我只是在我的ubuntu服务器上安装了它。“我以前升级过mysql版本”请添加您升级到哪个版本的信息。如果升级到8.0+,请参阅: