简体   繁体   English

主机'localhost'不允许连接到此MySQL服务器

[英]Host 'localhost' is not allowed to connect to this MySQL server

I wish to install WAMP Server on my PC and then Wordpress on Apache. 我希望在我的PC上安装WAMP Server,然后在Apache上安装Wordpress。 I successfully installed WAMP. 我成功安装了WAMP。 Launched the service to realize that phpmyadmin wasn't working. 启动服务以意识到phpmyadmin无法正常工作。 I was recieving the error mentioned in the title. 我收到了标题中提到的错误。 So i thought of resetting the root password, flushing the privileges and then creating a database(Which i could have done via phpmyadmin). 所以我想重置root密码,刷新权限然后创建一个数据库(我可以通过phpmyadmin完成)。

So i reset the mysql root password. 所以我重置了mysql root密码。 I then tried again to run phpmyadmin..DIDN'T WORK! 然后我再次尝试运行phpmyadmin..DIDN'T WORK! (I did edit the config file) (我确实编辑了配置文件)

Worst part of it all is that mysql console wont work either! 最糟糕的是,mysql控制台也不会工作! I get the same error! 我犯了同样的错误!

I am kinda new to all this...Please help1!!! 我对这一切都很新...请帮助1 !!! :'( :'(

I changed this: 我改变了这个:

GRANT ALL ON database.* TO user@* IDENTIFIED BY 'password';

to: 至:

GRANT ALL ON database.* TO user IDENTIFIED BY 'password';

then it works. 然后它工作。

  • Go to cmd. 转到cmd。
  • cd to C:\\wamp\\bin\\mysql\\mysql5.5.8\\bin (or wtvr path you have) cd到C:\\wamp\\bin\\mysql\\mysql5.5.8\\bin (或你有的wtvr路径)
  • run mysql -uroot -p 运行mysql -uroot -p
  • GRANT ALL ON database.* TO user@* IDENTIFIED BY 'password'; For example: GRANT ALL ON mydatabase.* TO root@* IDENTIFIED BY 'secretpass'; 例如: GRANT ALL ON mydatabase.* TO root@* IDENTIFIED BY 'secretpass';
  • FLUSH PRIVILEGES; FLUSH特权;

Setup config.inc.php from phpMyAdmin correctly (user root, password wtvr, host localhost, etc.): 从phpMyAdmin正确设置config.inc.php(用户root,密码wtvr,host localhost等):

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'secretpass';

Try this- 尝试这个-

1) Go to WAMP folder on your C drive. 1)转到C盘上的WAMP文件夹。

2) Go to alias folder and open phpmyadmin.conf file 2)转到别名文件夹并打开phpmyadmin.conf文件

3) Original file look like this- 3)原始文件看起来像这样 -

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Change it to- 改为 -

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all

you should use this.., 你应该用这个..,

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'password';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不允许主机 'localhost' 连接到此 MySQL 服务器 (#1130) - host 'localhost' is not allowed to connect to this MySQL server (#1130) #1130 - 不允许主机 'localhost' 连接到这个 MySQL 服务器 - #1130 - Host ‘localhost’ is not allowed to connect to this MySQL server #1130-不允许主机“ localhost”连接到该MySQL服务器 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server #1130 - 不允许主机'localhost'连接到此MySQL服务器 - #1130 - Host ‘localhost’ is not allowed to connect to this MySQL server #1130-不允许主机“ localhost”连接到该MySQL服务器 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server 主机不允许连接到该MySql服务器 - Host is not allowed to connect to this MySql server 不允许主机“ localhost”连接到此MySQL服务器-授予root @ localhost无效 - Host 'localhost' is not allowed to connect to this MySQL server - grant to root@localhost not working 一些请求返回 SQLSTATE[HY000] [1130] 不允许主机 'localhost' 连接到生产服务器上的此 MySQL 服务器 - some requests return SQLSTATE[HY000] [1130] Host 'localhost' is not allowed to connect to this MySQL server on production server MySQL 主机 '::1' 或 '127.0.0.1' 不允许连接到此 MySQL 服务器 - MySQL Host '::1' or '127.0.0.1' is not allowed to connect to this MySQL server #1130 - 主机 'localhost' 不允许连接到此 MySQL 服务器 - 运行 Acunetix 扫描后 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server - After running an Acunetix scan
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM