5

enter image description here

I cannot open the local instance in MySQL Workbench in Ubuntu 20.04 after installing the MySQL server. I searched for some similar topics here but these did not help.

Solution Found: I've found the solutions for this problem. This was because of the MySQL Workbench couldn't store password in keychain and also because it failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user 'root'@'localhost'(using password:YES).

Use this command in the terminal: sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service.

The snap package is sandboxed as usual and is not by default allowed to access the service. MySQLWorkbench is blocked by AppArmor when we choose "Store in keychain" option. That's why we need to enter the command to allow the package to access the service.

The solution links that helped me:

MySQL Workbench not saving passwords in keychain

Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user 'root'@'localhost'(using password:YES)

Aditya Datta
  • 111
  • 1
  • 1
  • 7
  • You can use this URL to fix that issue: https://blockdev.io/mysql-workbench-ubuntu-20-04-and-app-armor/ – zedfoxus May 14 '22 at 02:36

3 Answers3

6

All I need to do here is mainly type the following command in the terminal:

sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service

Here, the snap package is sandboxed as usual and is not by default allowed to access the service. MySQLWorkbench is blocked by AppArmor when we choose "Store in keychain" option. That's why we need to enter the command to allow the package to access the service.

Aditya Datta
  • 111
  • 1
  • 1
  • 7
  • So, why does that work? – geertjanknapen May 27 '22 at 10:22
  • Because the snap package is sandboxed as usual and is not by default allowed to access the service. MySQLWorkbench is blocked by AppArmor when we choose "Store in keychain" option. That's why we need to enter the command to allow the package to access the service. – Aditya Datta May 28 '22 at 23:32
3

Try adding this step.

  1. login to mysql in the terminal

  2. execute this command

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

  3. Check if this solved your problem <NOTE THE 'password' PART, CHANGE IT TO THE PASSWORD YOU WANT TO USE>

I tried all of the above steps, this one was the one that solved for me.

0

Make sure all the mentioned things working.

First check mysql is running by running below command:

sudo systemctl status mysql

If it's running make sure that your mysql username is root and password you are entering is correct. If still not working make sure you have given all the privileges to user "root".

If don't know how to set privileges read this article carefully.

https://docs.rackspace.com/support/how-to/install-mysql-server-on-the-ubuntu-operating-system/

Zartash Zulfiqar
  • 93
  • 1
  • 3
  • 13