ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
出现原因:
mysql user表数据为空,登陆出现“Host 'localhost' is not allowed to connect to this MySQL server..."
尝试另一个mysql库中的user表,覆盖,不行。
解决:
编辑 my.ini
在[mysqld]的段中加上一句:skip-grant-tables
代码如下:
[mysqld] character-set-server=utf8 # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. #Path to installation directory. All paths are usually resolved relative to this. basedir="D:/Program Files/MySQL/MySQL Server 5.6/" #Path to the database root datadir="D:/Program Files/MySQL/MySQL Server 5.6/data/" port = 3306 # server_id = ..... server_id = 5 log_bin=mysql-bin # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M skip-grant-tables sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
目的是为了:
跳过MySQL的访问控制,任何人都可以在控制台以管理员的身份进入MySQL数据库。
需要注意的是在修改完密码以后要把MySQL服务器停掉重新启动才会生效
注意:本文归作者所有,未经作者允许,不得转载