• Digital accessories
  • Server
  • Digitalni život
  • Privacy policy
  • Contact us
  1. Home
  2. Server
  3. Cannot connect to Database server (mysql workbench)

Cannot connect to Database server (mysql workbench)

Rsdaa 28/01/2022 1073


Could you help me solve this problem ?

When I try to click "query database" under database menu in Mysql workbench. it gives me an error:

Cannot Connect to Database Server

Your connection attempt failed for user 'root' from your host to server at't connect to mysql server on ''(10061)


Check that mysql is running on server that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)Check the root has rights to connect to from your address (mysql rights define what clients can connect to the server and from which machines)Make sure you are both providing a password if needed and using the correct password for connecting from the host address you're connecting from


4,309 1 1 gold badge 24 24 silver badges 31 31 bronze badges

user948950 user948950

1,187 2 2 gold badges 9 9 silver badges 9 9 bronze badges


The issue is likely due to socket authentication being enabled for the root user by default when no password is set, during the upgrade to ubuntu 16.04.

The solution is to revert back to native password authentication. You can do this by logging in to MySQL using socket authentication by doing:

sudo mysql -u root

Once logged in:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

which will revert back to the native (old default) password authentication.

Now use password as the password whenever required by MySQL.


Try opening services.msc from the start menu search box and try manually starting the MySQL service or directly write services.msc in Run box


It looks like there are a lot of causes of this error.

In my case, the cause was that my server was configured to only accept connections from localhost. I fixed it by following this article: How Do I Enable Remote Access To MySQL Database Server?. My my.cnf file had no skip-networking line, so I just changed the line

bind-address =


bind-address =

This allows connections from any IP, not just

Then, I created a MySql user that could connect from my client machine by running the following terminal commands:

# mysql -u root -p mysql> CREATE USER 'username'@'' IDENTIFIED BY 'password'; -> GRANT ALL PRIVILEGES ON *.* TO 'username'@'' WITH GRANT OPTION; -> \q

where is the IP of the client you are trying to connect from. If you really have trouble, you can use '%' instead of '' to allow the user to connect from any IP.

For a fairly extensive list, see Causes of Access-Denied Errors.


I had a similar issue on Mac OS and I was able to fix it this way:

From the terminal, run:

mysql -u root -p -h -P 3306

Then, I was asked to enter the password. I just pressed enter since no password was setup.

I got a message as follows:

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 181. Server version: 8.0.11 Homebrew.

If you succeeded to log into mysql>, run the following command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

You should get a message like this:

Query OK, 0 rows affected (0.19 sec)

Now, your password is " password" and your username is " root".

Happy coding :)


I had to start Workbench as Administrator. Apparently it didn't have the required permissions to connect to my localhost database server process.

Right-click the Workbench shortcut and select Run as Administrator. In the shortcut's Properties window, you can click on "Advanced" and tick the box next to "Run as Administrator" to always run the Workbench with Admin privileges.


For those who ignored that the initial error message displaying is the following one:

The name org.freedesktop.secrets was not provided by any .service files

Make sure to install gnome-keyring using the following

sudo apt install gnome-keyring

Forr me reason was that I tried to use newest MySQL Workbench 8.x to connect to MySQL Server 5.1 (both running on Windows Server 2012).

When I uninstalled MySQL Workbench 8.x and installed MySQL Workbench 6.3.10 it successfully connected to localhost database

In my case I have just installed MySQL Workbench but after uninstalling MySQL Workbench and installing MySQL installer and is same for both 32 and 64 bit then after it working like a charm. Hope it could be useful.

I was in similar situations before and last time I found it was some Windows update issue(not sure). This time, I opened MySQL workbench and found no connection to my local database. I cannot see my tables, but yesterday I could connect to the database.

I found that my cause is that, after letting my computer sleeping for some time and wake it again, the mysql service is not running. My solution: restart the service named "mysql" and rerun the workbench. Restarting the service takes a while, but it works.

My problem was that the MySQL server wasn't actually installed. I had run the MySQL Installer, but it didn't install the MySQL server.

I reran the installer, click "Add", and then added MySQL server to the list. Now it works fine.

In my case, the instalation didn't add MySQL\MySQL Server 5.7/bin folder to my PATH env variable.

Right click on your task bar -> Task Manager

Click on Services button

Search for MYSQL80 or any other you are using

Right Click on MYSQL80 --> Start

This works for me hope it does for you also

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Stack Overflow works best with JavaScript enabled

PREV: Setting Up A Virtual Host in Apache - AppTools

NEXT: Solved: How to connect Host machine to Virtual Machine ...

Popular Articles

Hot Articles
Back to Top