【发布时间】:2016-08-15 00:16:58
【问题描述】:
我在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 时,它可以工作,但不能远程工作。
有谁知道我缺少什么或如何解决这个问题?
【问题讨论】:
标签: mysql mysql-workbench mariadb centos7