我在Centos 7上安装了Mariadb,我试图用MysqL Workbench访问它.
我做了以下事情:
启动MariaDB执行以下命令:
systemctl start mariadb.service
自动启动MariaDB执行以下命令:
systemctl enable mariadb.service
启动MariaDB(仅执行一次)后,执行以下命令:
/usr/bin/MysqL_secure_installation
我们还需要更改端口:
/etc/my.cnf.d/server.cnf
#Mariadb网络设置
[MysqLd]
# comment out the bind address
#bind_address=127.0.0.1
[root@localhost ~]# MysqL -u root -p mcellblock -h 192.168.159.163 -P 3306
Enter password:
ERROR 1130 (HY000): Host '192.168.159.163' is not allowed to connect to this MariaDB server
然后我启用了连接权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'mcb'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
MariaDB [mcellblock]> select User, Host, password from MysqL.user where Host <> 'localhost';
+------+-----------------------+-------------------------------------------+
| User | Host | password |
+------+-----------------------+-------------------------------------------+
| root | localhost.localdomain | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | ::1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | % | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| mcb | % | *A071D903A1ABA9752B05C16C573A095C80A7AFAD |
+------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
现在,当我尝试通过终端访问时,它可以工作:
$MysqL -u mcb -p mcellblock -h 192.168.159.163 -P 3306
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 28
Server version: 5.5.47-MariaDB MariaDB Server
但是当我尝试通过MysqL Workbench访问时,我收到一个错误:
Please check
1) Check that MysqL is running on server 192.168.159.163 ** IT IS
2) Check that MysqL is running on port 3306 ** I can connect to it via the terminal so I assume it is
3) Check mcb has the rights to connect to 192.168.159.163 from your address ** It should as its setup for %
4) Make sure you are both providing a password if needed and using the correct password for 192.168.159.163 ** the passwords are the same
当我在本地安装MysqL Workbench时,它可以工作但不能远程工作.
有谁知道我错过了什么或如何解决这个问题?
@H_502_77@解决方法:事实证明这是centos机器上的防火墙问题.用telnet IP_ADDRESS 3306检查后,我无法通过我的其他VM或Windows访问.禁用防火墙后,它工作正常.
@Alex我以前也检查了端口,它正在正确收听.谢谢您的意见.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。