Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

host localhost is not allowed to connect to this MySQL server [closed]

I've accidentally deleted my users table (removed all users) now whenever I try to access my database it says: "host localhost is not allowed to connect to this MYSQL Server". I've tried connecting directly, same error. I'm using apache xampp for this.

like image 528
saasaa Avatar asked Jul 28 '14 20:07

saasaa


People also ask

Is not allowed to connect to this MySQL server localhost?

A quick solution is to create a new user with admin access: CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *. * TO 'username'@'localhost' WITH GRANT OPTION; CREATE USER 'username'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.

How do I access MySQL server on localhost?

Enter 127.0. 0.1 for the host. The default username for a new MySQL installation is root, with a blank password. You can leave the port field blank unless your server uses a different port than 3306.


1 Answers

A very commonly asked question, try doing this (and it worked for me), goto your mysql folder and there will be a file called my.ini. Simply add skip-grant-tables (without an argument) in the [mysqld] section as below:

[mysqld]
port=3306
skip-grant-tables

Save the file, restart your server. If the problem still exists, refer to this link.

like image 124
Talha Tanveer Avatar answered Sep 20 '22 14:09

Talha Tanveer