It can be a bit painful to get the database connection started from your PHPStorm IDE to your MySQL database.
As a quick hint, this is where it went wrong with mine:
- MySQL wasn’t listening for incoming connections on the network (change directive bind-address to 0.0.0.0
in /etc/mysql/my.cnf and restart MySQL) - My database user was only allowed to connect from localhost
Edit the file /etc/mysql/my.cnf to configure MySQL to listen for incoming database connections from the network:
$ vi /etc/mysql/my.cnf ... bind-addres = 0.0.0.0 ... $ sudo service mysql restart
Then I added a new user (dbuser) which is allowed to connect from my workstation (workstation.i2s.nl):
mysql> CREATE USER 'dbuser'@'workstation.i2s.nl' IDENTIFIED BY PASSWORD ''; mysql> GRANT ALL PRIVILEGES ON `<your_database>` . * TO 'dbuser'@'workstation.i2s.nl'; mysql> FLUSH PRIVILEGES;