Error 10061 / Port 3306 appears to be closed on my Ubuntu server

The problem was that the server was listening internally only. Removing the line bind-address 127.0.0.1 from /etc/mysql/my.cnf solved the issue. In Ubuntu 16 and MYSQL 5.7, the configuration file was in:

/etc/mysql/mysql.conf.d/mysqld.cnf

Error 1045(28000) / Error connecting in console (local) / Access denied for user ‘root@localhost’ (using password: no )

if you want to make easier to access your mysql create .my.cnf in /root/ and put in it

[mysqladmin]
user = root
password = mysqlrootpassword
[mysql]
user = root
password = mysqlrootpassword
[mysqldump]
user = root
password = mysqlrootpassword

Fail to connect remotely from MYSQL Workbentch of the client (ex 192.168.0.30)

$ mysql -u root -p
Enter password:
mysql> use mysql
mysql> GRANT ALL ON *.* to root@'192.168.0.30' IDENTIFIED BY 'your-root-password'; 
mysql> FLUSH PRIVILEGES;

Error 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Wrong Server ip in the /etc/mysql/my.conf

  1. Log in as super user or use sudo
  2. Open /etc/mysql/my.cnf using gedit
  3. Find bind-address, and change its value to the database server host machine’s IP address. For me, it was localhost or 127.0.0.1
  4. Save and close the file
  5. Come back to terminal and execute sudo service mysql start