我用AWS制作了一个EC2用户服务器。然后安装mysql,我已经在谷歌上搜索过这个问题,然后我检查我做得很好。
# mysql --version
mysql Ver 14.14 Distrib 5.5.58, for Linux (x86_64) using readline 5.1首先,设置aws入站0.0.0.0:3306
# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 其次,为0.0.0.0创建mysql用户'yj‘。(我也试过%。但这不管用。所以我也尝试了“0.0.0.0”。)
mysql> select host, user, password from mysql.user;
+------------------+------+-------------------------------------------+
| host | user | password |
+------------------+------+-------------------------------------------+
| localhost | root | *some-password |
| ip-172-31-86-160 | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| ip-172-31-86-160 | | |
| 0.0.0.0 | yj | *some-password |
+------------------+------+-------------------------------------------+第三,检查/etc/my.cnf文件。
# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid人们说将bind-address=127.0.0.1修改为bind-address=0.0.0.0。但是我的.cnf文件没有绑定地址。因此,我试图在/etc/mysql/mysql.conf.d或/etc/mysql.conf中找到另一个conf文件,等等。但是没有/etc/my.cnf文件就什么都没有了。
你能告诉我我错过了什么吗?
发布于 2018-05-21 16:34:38
解出
我解决了问题是因为学校的wi。也许有something...you知道。
因此,连接拒绝了消息,即'Connection failed: Access denied for user 'yj'@'some-ip'。'some-ip'和我所用的不一样。所以我用那个ip来创建用户。现在工作得很好。
我希望这能帮上忙。
发布于 2018-05-21 13:54:00
你试过:
CREATE USER 'yj'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'yj'@'localhost';
FLUSH PRIVILEGES;您可以通过以下方式检查用户权限:
SHOW GRANTS yj;尝试用实际使用的主机替换'localhost',我猜它是:
'0.0.0.0'https://stackoverflow.com/questions/50435880
复制相似问题