错误是1045.但我的用户名和密码是正确的。
我从192.168.0.18连接到fcapdi(到192.168.0.240:3306)
我的用户表
MariaDB [(none)]> SELECT User,Host FROM mysql.user;
+--------+-----------+
| User | Host |
+--------+-----------+
| dba | % |
| fcapdi | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | tester |
| root | tester |
+--------+-----------+
当我使用我收到的root
帐户使用phpMyAdmin登录时
#1045 - 用户'root'@'localhost'拒绝访问(使用密码:YES)
但是我的帐号dba可以正常登录。发生了什么事?
另外我想我应该注意到MySQL实例位于具有2个NIC的服务器上,并且位于2个(内部)网络上。一个是本地域192.168.0/24
,另一个是更大的域10.228./16
。
我可以通过10.228./16
网络中的fcapdi帐户登录。但不是来自192.168.0./24
网络。
答案 0 :(得分:1)
执行:
GRANT ALL ON
your_database_schema_name.* to
'fcapdi'@'192.168.0.18' IDENTIFIED BY 'your_connection_password';
作为服务器上具有GRANT权限的用户并尝试连接。
答案 1 :(得分:1)
As an aside question under comments
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newPass123^');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newPass123^');
SET PASSWORD FOR 'root'@'etc_etc' = PASSWORD('newPass123^');
you can also do it in a single update statement but it depends on your mysql version
create user 'joe1'@'localhost' identified by 'blah';
create user 'joe1'@'127.0.0.1' identified by 'afadfafsdblah2';
create user 'joe1'@'%' identified by 'djdjdjjdjdd';;
select user,host,password from mysql.user where user='joe1';
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| joe1 | localhost | *0380BEA27363E56C37F0BFDA438F429080848051 |
| joe1 | % | *7BEAF25E9BDFBDEF5A9B9E4A37023721B668FA51 |
| joe1 | 127.0.0.1 | *5CD978E569B31B1558E5C1D0972E6E02516893BF |
+------+-----------+-------------------------------------------+
update mysql.user set password=PASSWORD('nEW_COMMon_password762') where user='joe1';
-- 3 rows updated
select user,host,password from mysql.user where user='joe1';
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| joe1 | localhost | *A248B352CE5BF750A11AA9BA253B5F191C721D1A |
| joe1 | % | *A248B352CE5BF750A11AA9BA253B5F191C721D1A |
| joe1 | 127.0.0.1 | *A248B352CE5BF750A11AA9BA253B5F191C721D1A |
+------+-----------+-------------------------------------------+
对于Mysql 5.7,不是名为password
的列。而是针对authentication_string
清理:
drop user 'joe1'@'%';
drop user 'joe1'@'127.0.0.1';
drop user 'joe1'@'localhost';