由于无效的服务器主机名绑定地址而导致访问被拒绝

我无法使用terminallogin到MySQL。

[root@fst mysql]# mysql -h localhost -u admin -p Enter password: ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES) 

我确定我有正确的密码。 当我检查状态时,mysql也在运行。 mysql数据库也存在于目录/ var / lib / mysql /中。 主机host.myi,host.myd和host.frm存在。

顺便说一句,这个问题涉及到我以前的问题MySQL服务器退出而不更新PID文件 。 最初,根目录已满时出现问题。 为了能够login到directadmin并启动mysql,我添加了一个/ var / lib / mysql / to / home / mysql的软链接。 由于我的数据库用完了大部分的根目录。 根目录有50Gb,/ home有1.5Gb。 不知何故/ var / lib / mysql / idbdata1已损坏。 所以我把它移到另一个地方。

现在,我可以启动mysql服务器,但我无法login到它。

以下是myql日志的内容。

 121212 20:44:10 mysqld_safe mysqld from pid file /var/lib/mysql/fst.srv.net.pid ended 121212 20:44:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 121212 20:44:10 [Note] Plugin 'FEDERATED' is disabled. 121212 20:44:10 InnoDB: The InnoDB memory heap is disabled 121212 20:44:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins 121212 20:44:10 InnoDB: Compressed tables use zlib 1.2.3 121212 20:44:10 InnoDB: Using Linux native AIO 121212 20:44:10 InnoDB: Initializing buffer pool, size = 128.0M 121212 20:44:10 InnoDB: Completed initialization of buffer pool 121212 20:44:10 InnoDB: highest supported file format is Barracuda. 121212 20:44:11 InnoDB: Waiting for the background threads to start 121212 20:44:12 InnoDB: 1.1.8 started; log sequence number 1595675 121212 20:44:12 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 121212 20:44:12 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 121212 20:44:12 [Note] Server socket created on IP: '0.0.0.0'. 121212 20:44:12 [Note] Event Scheduler: Loaded 0 events 121212 20:44:12 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.5.27-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) 

我猜这个绑定地址有问题。 我应该如何解决这个问题?

只需重置密码,并确保你的用户名和主机规格在mysql.user表中是正确的 – “拒绝访问”错误意味着你到达一个监听器,所以你的绑定地址不是问题。

skip-grant-tables添加到你的my.cnf并重新启动服务,然后查看mysql.user表,并根据需要更改主机和密码 – 确保将skip-grant-tables从configuration中取出当你完成了。