0

Hi if I use mysql itself I can see my tables and databases and I checked the port on the MySQL variables and it was the same as 3306.

I am not sure what's wrong. I also granted privileges to localhost for the user.

Here is a screenshot of what it shows me:

enter image description here

I think I just updated my PhpStorm and now it is not working any more.

    mysql> SELECT 
    ->    user 
    -> FROM 
    ->    mysql.user;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    49
Current database: *** NONE ***

+---------------+
| user          |
+---------------+
| imdi_mg2      |
| mysql.session |
| mysql.sys     |
| root          |
+---------------+
4 rows in set (0.11 sec)

I am not sure why mysql goes away and comes back in the middle

Nickool
  • 3,662
  • 10
  • 42
  • 72
  • 1) Looks like it's MariaDB and no MySQL. But anyway ... 2) Error 1130 means "Host '' is not allowed to connect to this MariaDB server" E.g. https://stackoverflow.com/questions/48771015/mysqlmariadb-unknow-error-1130 – LazyOne Jun 18 '21 at 14:11
  • What's your previous and current PhpStorm versions? Right now I may suggest this: 1) try restarting whole thing (can help if it's some glitch) 2) Show how users are defined. 3) Try creating a new DB connection from scratch in PhpStorm. 4) Does it use SSL? try without if it does. – LazyOne Jun 18 '21 at 14:16
  • so it does not use ssl and I restarted my computer completely and did not help, I will update with users defined. – Nickool Jun 18 '21 at 14:17
  • @LazyOne updated the ticket – Nickool Jun 18 '21 at 14:20
  • 1) Is it actually MySQL or MariaDB? Based on the error message it looks more like MariaDB. If that's so -- try creating a new DB Connection (Data Source) in PhpStorm and use Maria DB as connection/driver. 2) (just a wild guess) Maybe you have some proxy when connecting to this server... 3) By "how user is defined" I mean -- is it something like `user@localhost` .. or perhaps it's `user@%` etc (to see from what hosts it can connect from). TBH, I personally do not know what eslse to suggest right now... – LazyOne Jun 18 '21 at 14:29
  • @LazyOne it is mysql :( not mariaDB why you say MariaDB!??? – Nickool Jun 18 '21 at 14:39
  • Why? Because in those MySQL versions that I use (5.7.x) an error message with such code shows different wording and such "Unknown error 1130” is often found when MariaDB is used (based on the my search results on Google). That's why I was suggesting to double check this (note: I have no idea how you have it installed; maybe it's a part of some bundle/script and you may not know for sure what exactly is running there; e.g. I have 1 project where it's MariaDB on production but PHP works with it using the same MySQL PDO driver). – LazyOne Jun 18 '21 at 14:52
  • fixed my issue I changed the permission to GRANT ALL PRIVILEGES ON imdi_mg2.* TO 'admin'@'%' WITH GRANT OPTION; and it worked – Nickool Jun 18 '21 at 15:10
  • so although I had localhost the grant should have been % this is so weird – Nickool Jun 18 '21 at 15:10

1 Answers1

1

not sure how but grant should be on % not on localhost this was really annoying:

 create user 'user'@'%' identified by 'pass'
 GRANT ALL PRIVILEGES ON imdi_mg2.* TO 'user'@'%' WITH GRANT OPTION;

there will be people having this issue hopefully helps someone!

Nickool
  • 3,662
  • 10
  • 42
  • 72