Mysql workbench ошибка unable to connect to localhost

MySQL Workbench could not connect to MySQL

MySQL Database (Db) is a database service that runs on a Local Server and on the Web. It is ideal for both small and large applications and it uses the standard SQL language. MySQL is free to download and use and has the most comprehensive set of advanced features, management tools, and technical support to achieve the highest levels of MySQL scalability, security, reliability, and uptime. The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows, and the Db is useful for storing information categorically. This article, you will learn how to fix MySQL Workbench could not connect to MySQL server on the localhost 10061. In this article, you will learn how to fix ‘MySQL Workbench could not connect to MySQL server”

Note: It is worth noting that by default, the MySQL server listens for connections only from localhost. Which means it can be accessed only by applications running on the same host. But in production environments, you can allow remote access to the MySQL server.  

In this aspect, you will have to configure the MySQL server to listen on a specific IP address. Or all IP addresses on the server. See the following guides on MySQL. How to reset Mysql Root password, how to access MySQL Server from command Prompt, how to create and delete MySQL database, and how to migrate Veeam MsSQL Database to a new MsSQL Server.

This article shows the steps to resolve connection issues to MySQL Servers. See how to install Microsoft SQL Server 2019 and MsSQL Command line tools on Ubuntu Linux, how to uninstall Microsoft SQL Server on Windows 10 and Windows Server, and how to download and install Microsoft SQL Server 2019 Developer Edition and Microsoft SQL Server Management Studio on Windows 10 and Windows Server.

This error is shown in because the application was unable to connect to the MySQL server. There could be a number of reasons. But in my case, it was because the service was stopped and the service was not running. To fix this issue, kindly follow the steps below.

Launch MySQL Workbench to open the home screen. Existing connections are shown when you click the MySQL Connections view from the sidebar. No connections exist for first-time users.

Launch MySQL Workbench

Click on the Server Menu and click on Startup/Shutdown option as shown below

This will open up the Administration -Startup/Shutdown window. Click on Start Server

Accept the UAC. Next, you will be required to enter your password in order to start the database server. Enter your password and click on OK.

From the Administration, the Startup/Shutdown window, you should see the server is now running. And on this window, you can stop or take the server offline.

As you can see, the MySQL service is also running. And this is all that is needed to resolve this connection issue.

I hope you found this blog post helpful. You have learned how to fix the following error “MySQL Workbench could not connect to MySQL server on the localhost 10061”. If you have any questions, please let me know in the comment session.

I just installed MySQL Workbench and there are no connections available for my localhost server. When I try to make one, I get an error popup. Has anyone experienced something like this before and would be able to help me out?

Here is what it looks like on start up:

MySQL home page

And if I try to make a connection myself it shows this:
enter image description here

Any help would be much appreciated — thanks!

Anil's user avatar

Anil

2,5396 gold badges33 silver badges42 bronze badges

asked Dec 6, 2013 at 18:55

scapegoat17's user avatar

scapegoat17scapegoat17

5,52914 gold badges55 silver badges91 bronze badges

3

Sounds like you only installed the MySQL Client Tools (MySQL Workbench). You have to install the MySQL Database server, configure and start it.

http://dev.mysql.com/downloads/

You probably want the MySQL Community Server download.

answered Dec 6, 2013 at 19:02

James Smith's user avatar

5

For Win users:

Check if the MYSQL service is running or not. To check the service is running or not. Use the below steps:

  • Step1: Open the Services Desktop app from the Windows menu.

enter image description here

  • Step 2: Then search the list of services to identify the name of the
    MySQL service.
    enter image description here
  • Step 3: Right-click on the service name to open the menu.
  • Step 4: Start the service if it is not running.

ino's user avatar

ino

2,3551 gold badge15 silver badges28 bronze badges

answered Jan 30, 2022 at 10:45

Chitransh Agarwal's user avatar

4

Solution:

  1. Open up your mysql installer.
  2. Click on Reconfigure, shown in red. https://i.stack.imgur.com/FUYnk.jpg
  3. In that, Click on next until you enter the Accounts and Roles tab.
  4. Create a password and then, click next for the rest of the tabs.

Now, try again!👍

ino's user avatar

ino

2,3551 gold badge15 silver badges28 bronze badges

answered Apr 16, 2021 at 6:14

MassDev's user avatar

MassDevMassDev

611 silver badge1 bronze badge

Its Worked for me on Windows

First i installed and started XAMPP Control Panel
enter image description here

Clicked for Start under Actions for MySQL. And below is my Configuration for MySQL (MySQL Workbench 8.0 CE) Connections
enter image description here
And it got connected with Test DataBase

answered Apr 1, 2019 at 7:41

Dharmendra Prajapati's user avatar

If xamp already installed on your computer user these settings

enter image description here

answered Dec 17, 2014 at 6:10

UMAIR ALI's user avatar

UMAIR ALIUMAIR ALI

1,0555 gold badges14 silver badges25 bronze badges

1

I had this problem and I just realized that if in the server you see the user in the menu SERVER -> USERS AND PRIVILEGES and find the user who has % as HOSTNAME, you can use it instead the root user.

That’s all

answered Apr 23, 2015 at 16:33

user4825230's user avatar

enter image description here

I think you want to config your database server firstly after the installation, as shown in picture, you can reconfigure MySql server

answered Jan 28, 2021 at 20:45

hossam ibrahem's user avatar

  1. Install MySQL installer.
  2. Select Add… from the right side and install the latest version of MySQL server.

I hope this will work. It worked for me. Thank You.

answered Nov 2, 2022 at 21:13

Manthan Kurhekar's user avatar

1

services->mysql (on left corner click on start)

answered Jun 18 at 9:40

Rahul Raj's user avatar

1

if you are using localhost database, try port 3306

answered Apr 1, 2018 at 16:08

ContexDev's user avatar

1

My MySQL Workbench is not connecting to my local host, and I cannot figure out why exactly it is reacting like this. It just started doing this one day, and randomly it will give me access although it says it is still «unknown», but I am tired of this and would like to fix it.

Since this website reqires that I have a «10» reputation to post images, I will have to describe it.

On the Startup/Shutdown tab in the administration page, it says:

The database server instance is unknown. —The «Start Server» button is faded out so that I cannot click it.

Startup Message Log
2013-07-11 08:57:51 — Workbench will use cmd shell commands to start/stop this instance

2013-07-11 08:57:51 — Status check of service ‘MySQL’ returned error: Not found

2013-07-11 08:57:51 — Status check of service ‘MySQL’ returned error: Not found

2013-07-11 09:00:55 — Status check of service ‘MySQL’ returned error: Not found

2013-07-11 09:00:55 — Status check of service ‘MySQL’ returned error: Not found

2013-07-11 09:02:01 — Status check of service ‘MySQL’ returned error: Not found

Then on the server status tab in the administration page, it says:

Name: mysqld@localhost
host: localhost
server:unknown
status: unknown

Connection
There is no connection to the MySQL server. This functionality requires an established connection to a running MySQL server to work.

If anyone can help out, that would be great!

Thanks

I also struggled with this problem for quite a while.

I came accross this interesting thread from MySQL forum: http://forums.mysql.com/read.php?11,11388,11388#msg-11388

I also came accross (obviously) some good SO Q/A.

It seems that the message mentioned in «user948950» ‘s question can be coming from a wide range of reasons: log file too big, incorrect mysql.ini file values, spaces in the file path, security/acl issue, old entries in the registry, and so on.

So, after trying for 3h to fix this… I abandonned and decided to do a good old re-install.

This is where this post from (again) this MySQL thread came in useful, I quote:

Gary Williams wrote: Hi Guys,

I’ve had exactly the same problem and this is how I got it working
for me, starting with a non working installation.

  1. Stop the windows service for any existing mysql installation.

  2. Uninstall Mysql.

As with most uninstalls, old files are left behind. If your directory
is C:mysql etc then delete the innob, etc, files but leave the
directories themselves as well as any existing databases in ‘data’.
If your directory is C:Program Files etc, delete all the mysql
directories.

  1. It’s now worth running regedit to make sure the old registry entries are deleted as well by the uninstall. If not, delete them.

  2. It’s ok to use the new .msi installer (essential files only), however ….

  3. Do not use their default install path! Some genius set a path with spaces in it! Choose the custom install and select a sensible path,
    ie, C:mysql (note from Adrien: C:mysqldata for … the data)

  4. Do not choose to alter the security settings. Uncheck the relevant box and the install will complete without having to set a root
    password.

I think I have remembered everything.

Good luck

Gary

I did get into troubles when simply copy/pasting the databases I had in my previous «data» directory to the new one. So the work around I found was to export each database (I know… a lot of fun) and then re-import them one by one.

FYI: I used the following command to import C:/<MySQLInstallDir>/My SQL Server x.x/bin/mysql -u root -p <dbName> < "<dirPathOfDump><dumpName>.sql", that is for instance C:/mysql/MySQL Server 5.6/bin/mysql -u root -p mySupaCoolDb < "C:mySupaCoolDbDump20130901.sql"

MySQL Workbench could not connect to MySQL

MySQL Database (Db) is a database service that runs on a Local Server and on the Web. It is ideal for both small and large applications and it uses the standard SQL language. MySQL is free to download and use and has the most comprehensive set of advanced features, management tools, and technical support to achieve the highest levels of MySQL scalability, security, reliability, and uptime. The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows, and the Db is useful for storing information categorically. This article, you will learn how to fix MySQL Workbench could not connect to MySQL server on the localhost 10061. In this article, you will learn how to fix ‘MySQL Workbench could not connect to MySQL server”

Note: It is worth noting that by default, the MySQL server listens for connections only from localhost. Which means it can be accessed only by applications running on the same host. But in production environments, you can allow remote access to the MySQL server.  

In this aspect, you will have to configure the MySQL server to listen on a specific IP address. Or all IP addresses on the server. See the following guides on MySQL. How to reset Mysql Root password, how to access MySQL Server from command Prompt, how to create and delete MySQL database, and how to migrate Veeam MsSQL Database to a new MsSQL Server.

This article shows the steps to resolve connection issues to MySQL Servers. See how to install Microsoft SQL Server 2019 and MsSQL Command line tools on Ubuntu Linux, how to uninstall Microsoft SQL Server on Windows 10 and Windows Server, and how to download and install Microsoft SQL Server 2019 Developer Edition and Microsoft SQL Server Management Studio on Windows 10 and Windows Server.

This error is shown in because the application was unable to connect to the MySQL server. There could be a number of reasons. But in my case, it was because the service was stopped and the service was not running. To fix this issue, kindly follow the steps below.

Launch MySQL Workbench to open the home screen. Existing connections are shown when you click the MySQL Connections view from the sidebar. No connections exist for first-time users.

Launch MySQL Workbench

Click on the Server Menu and click on Startup/Shutdown option as shown below

This will open up the Administration -Startup/Shutdown window. Click on Start Server

Accept the UAC. Next, you will be required to enter your password in order to start the database server. Enter your password and click on OK.

From the Administration, the Startup/Shutdown window, you should see the server is now running. And on this window, you can stop or take the server offline.

As you can see, the MySQL service is also running. And this is all that is needed to resolve this connection issue.

I hope you found this blog post helpful. You have learned how to fix the following error “MySQL Workbench could not connect to MySQL server on the localhost 10061”. If you have any questions, please let me know in the comment session.

I’m trying to connect to my MySQL server, which is sitting at home, having a static ip, from school using MySQL Workbench. So no localhost connection. When I put in all the right credentials and try to connect to the user that I set up for the job and runs with %
as host. I also already edited bind
to be 0.0.0.0
in the MySQL config. When I now try and connect, I get this: Error when trying to connect

What am I missing?

level 1

If the error you’re getting is unable to connect to localhost, then somewhere in your connection settings it’s set to try to connect to localhost instead of your home ip.

level 1

I figured it out. I had the database installed due to nextcloud and nextcloud installs mariadb which I can still access with the mysql command. I only changed the bind address in the mysql config, but not in the Maria DB config. Changed that and now it works.

level 1

I suppose your Database server has not public IP, you cannot connect to it outside of your home router.

level 1

You need to show your connection settings (i.e. in MySQL Workbench when you choose Database | Manage Connections and click on the connection you are using), and make sure those settings are right. Ideally post the picture here.

In mysql, Can’t connect to MySQL server on localhost error occurs when mysql is unable to connect to localhost due to the connection issue with mysql or a database configuration issue with mysql. You may see an error Can’t connect to MySQL server on ‘127.0.0.1’ when you connect to ip and unable to connect to localhost 3306. You can’t connect to mysql server on localhost or ip 127.0.0.1 (3306) because either the mysql server may not be started or it may not be running, or the network connection to the mysql server is not established, or the mysql server port is different.

Some times, the application can’t connect to local mysql server or mysql could not connect server may not be running or mysql unable to connect to localhost:3306. The application can’t connect to mysql server on ‘localhost:3306’.

If you are trying to access mysql server from a remote server, the error message “Can’t connect to MySQL server on ‘ localhost ‘” may be displayed in the application. This error occurs if the application is unable to connect to mysql server due to a variety of reasons. In this post, we will see the error message “Can’t connect to MySQL server on ‘ localhost ‘” and how to fix this error.

The error message indicates that there is a problem when connecting to mysql from the calling application. If you identify a connectivity issue, the error message will be fixed.

Can't connect to MySQL server on 'localhost'
Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Root Cause

The error is shown in the application because the application was unable to connect to the mysql server. There could be a number of reasons. This issue is caused by a network failure.

The network failure could be on mysql server side or on the connecting application side. The other reason is that the mysql server is not running on the server. Mysql may be shut down manually, or mysql may not be running on the server machine due to some error.

Solution 1

If the database is running on the local machine, run the ping command with localhost. If the database is running on the remote server, ping the ip of the database server. In this way, we can validate the database server is alive or shutdown or network issue. If the ping does not respond, check that the server is switched on. Check that the network cable is connected correctly.

For local machine

$> ping 127.0.0.1

For remote server

$> ping <ip of the remote server>

$> ping 172.168.1.3

Solution 2

Check that mysql is running or not in the database server. The mysql server may be switched off or stopped due to some critical error. try to restart the mysql server. Check the following command to check whether the mysql server is running or not.

$> netstat -ln | grep mysql

fcc1dd9a70716e73 stream      0      0 fcc1dd9a734eb92b                0                0                0 /tmp/mysqlx.sock
fcc1dd9a707174b3 stream      0      0 fcc1dd9a732f1f7b                0                0                0 /tmp/mysql.sock

The command above shows the network status of the mysql command. The command below will show whether or not the mysql port is listening. The default port number is 3306.

$> netstat -ln | grep 3306

tcp4       0      0  127.0.0.1.3306         127.0.0.1.53815        ESTABLISHED
tcp4       0      0  127.0.0.1.53815        127.0.0.1.3306         ESTABLISHED
tcp4       0      0  127.0.0.1.3306         127.0.0.1.53814        ESTABLISHED
tcp4       0      0  127.0.0.1.53814        127.0.0.1.3306         ESTABLISHED

If the above two commands do not return the expected result, check whether the mysql process is running or not using the following command.

$> ps -ax | grep mysql
  113 ??         4:47.15 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql  ... ... ... ... ... ... ... ... --early-plugin-load=keyring_file=keyring_file.so

Solution 3

If mysql is running, check the status of mysql service. If the server appears to be running. Stop the server and restart the service again. If mysql server is hung due to issues such as memory issues, the network issue will be resolved. Use the command below to check the service

$> sudo server mysql status

$> sudo server mysql stop

$> sudo server mysql start
$> sudo /etc/init.d/mysqld status

$> sudo /etc/init.d/mysqld stop

$> sudo /etc/init.d/mysqld start

Solution 4

The mysql server is running without error. Network issues have been resolved and no network issues have been identified. Now connect to mysql server using mysql command. You can also check using the telnet command

$> telnet 172.168.1.3 3306
$> mysql -u root -p -h <host name/ip>

if the port is different from the default port 3306

$> mysql -u root -p -h <host name/ip> -P <port>

Solution 5

If the above command is working successfully and you still see error in mysql. Check out my.cnf file. My.cnf file contains all configurations of mysql. Run the command below to find the location of my.cnf file,

$> mysql --help | grep my.cnf

or just run 

$> mysql --help

Open my.cnf file and search for the word bind-address. If there is an existing change as below. If it doesn’t exist, add the line below.

to refer the localhost 
bind-address = 127.0.0.1

to refer for any address
bind-address = 0.0.0.0

Solution 6

If all of the above steps are checked and configured, restart the mysql server. All changes will be updated and start with a new configuration. If there is an error in the configuration, mysql will throw an error and will not start the server. Run the command below to check and restart mysql server

$> sudo server mysql status

$> sudo server mysql stop

$> sudo server mysql start

Solution 7

Start the mysql server with install and initialize option and check the mysql server is running or not. if you are using windows, run the mysql server as admin.

C:Program FilesMySQLMySQL Serverbin>mysqld --install

C:Program FilesMySQLMySQL Serverbin>mysqld --initialize

Solution 8

If you are using windows operating system and mysql database is installed newly, then use “MySQL Installer – Community” from the menu to reconfigure. select “mysql server” in the product tab and click the “reconfigure” in the “Quick Action” tab. This will reconfigure the mysql database.

Oracle website seems to imply it only works on 15 and 14.
http://dev.mysql.com/downloads/workbench/

Also two of my Ubuntu 16.04 machines don’t seem to be able to connect (Access is Denied errors for root)

Picture

It installs okay. It opens okay. But it won’t connect to localhost.

Anyone have any luck?

asked May 16, 2016 at 23:34

Jonathan's user avatar

JonathanJonathan

3,7544 gold badges28 silver badges49 bronze badges

5

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 16.04. This important caveat is documented in the 16.04 release notes:

Password behaviour when the MySQL root password is empty has changed.
Packaging now enables socket authentication when the MySQL root
password is empty. This means that a non-root user can’t log in as the
MySQL root user with an empty password.

For whatever reason, the MySQL Workbench that came with 16.04 doesn’t work out of the box with MySQL server, at least for me. I tried using «Local Socket/Pipe» to connect in a number of different ways but to no avail.

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. If you’ve attempted some other method to fix the issue, you’ll want to make sure the «plugin» field in mysql.user is set to «auth_token», which may require using mysqld_safe to log in to MySQL in the event you’ve been tinketing with things, like I did.

Credit to Miguel Nieto’s blog post for this solution.

answered Jun 3, 2016 at 1:46

Mike M's user avatar

Mike MMike M

6114 silver badges2 bronze badges

6

MySQL 5.7 and up don’t support connecting as «root» in mysql-workbench so you must create a normal user and connect via that.

sudo mysql -u root -p

Create a user named «admin» and use that to connect in mysql-workbench.

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

answered Jul 1, 2016 at 21:55

Jonathan's user avatar

JonathanJonathan

3,7544 gold badges28 silver badges49 bronze badges

6

This question might be two years old but my work with mysql-workbench tonight seems to have given me the answer to it.

root user now users auth_socket authentication by default. The only way root can gain access is by being logged in as root.

I found this out by running mysql -u root both as root user and standard user.

It would not work under standard user.

So my next question was — what user does mysql-workbench run as. Turns out it runs as standard user by default. To get it to run as root user it has to be run from root. So I went into root user CLI and type ‘mysql-workbench’.

I then had to go into the settings for the root user as shown here. The file location is valid for an ubuntu 18.04 installation.

Root connection settings mysql-workbench.

If that socket location is invalid then you’ll need to go into the mysql CLI from root or sudo and run the following command.

MySQL CLI command to find the socket.

After you have the correct settings test the connection. It should be successful and you’re ready to go.

abu_bua's user avatar

abu_bua

10.3k10 gold badges41 silver badges61 bronze badges

answered Sep 26, 2018 at 14:36

George Tasker's user avatar

3

Create an user account with appropriate administrative privileges that can connect via mysql workbench using the auth_socket plugin. Note that this does not work for root connections to the mysql server.

Logon to mysql from a terminal session:

$sudo mysql

If you are able to do this then the auth_socket plugin is enabled and the root account is authenticating using this plugin. Note that this is the default setup when installing mysql on ubuntu after having run the secure installation script.

First create a mysql user for your account ‘valerie’:

mysql> CREATE USER 'valerie'@'localhost' IDENTIFIED WITH auth_socket;

Enable administrative privileges for the account:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'valerie'@'localhost' WITH GRANT OPTION;

Exit the shell:

mysql> exit

Then in mysql workbench:

  1. Create a new connection
  2. Select the connection method as Local Socket/Pipe
  3. Set the Socket/Pipe Path to: /var/run/mysqld/mysqld.sock (note that this is the path for a Debian / Ubuntu system and changes for other flavors of Linux)
  4. Set the username (‘valerie’ in this example)

You should be able to then connect to the mysql server with this connection.

answered Aug 19, 2018 at 4:31

David's user avatar

DavidDavid

311 bronze badge

Try this

select mysql database

use mysql;
UPDATE user set plugin='mysql_native_password' where User='root';
flush privileges;
exit;

Then

sudo service mysql restart

zx485's user avatar

zx485

2,20311 gold badges24 silver badges31 bronze badges

answered Jul 21, 2019 at 20:25

URI's user avatar

Open terminal of your ubuntu system and enter below code,

In my ubuntu 20.04 os system it works fine, able to enter password and workbeanch working fine.

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

answered Jun 20, 2022 at 17:45

Daxesh Prajapati's user avatar

2

Works fine for me and I did nothing special. Installed mysql-server-5.7 and workbench both from command line and set up a user with a password and set up the normal database permissions (also with the normal method).

enter image description here

And with a database and table:

enter image description here

answered May 18, 2016 at 20:01

Rinzwind's user avatar

RinzwindRinzwind

290k39 gold badges562 silver badges703 bronze badges

1

If you are getting this error in Workbench then follow this steps.

First simply log in with your current password:

sudo mysql -u root -p

Then change your password because having low strength password gives error sometimes.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-strong-password';

FLUSH PRIVILEGES;

Then simply exit and again login with your new password:

quit

sudo mysql -u root -p

Once you successfully logged in type the command:

use mysql;

It should show a message like ‘Database changed’ then type:

UPDATE user SET plugin='mysql_native_password' WHERE User='root';

After that type:

UPDATE mysql.user set authentication_string=PASSWORD('new-strong-password') where user='root';

Then type:

FLUSH PRIVILEGES;

Then simply exit:

quit

Now try to log in with your new password in your WORKBENCH. Hope it will work. Thank you.

answered Apr 17, 2020 at 16:52

Tanmoy Bhowmick's user avatar

1

I had the same problem on newly installed 21.04 Ubuntu, after trying all these methods that didn’t quite work.

I tried to go into settings and allowed all the permissions and it worked for some reason.

Screenshot of the mysql setting

Greenonline's user avatar

Greenonline

2,0008 gold badges20 silver badges27 bronze badges

answered Oct 12, 2021 at 10:43

Keith John Smith's user avatar

2

MySQL server on AWS host running Ubuntu 16.04; mysql-workbench on Ubuntu 16.04 laptop; uses KeyPair connection.

After setting up Test db connection was working.
But the actual connection always failed with a message like the one posted by Jonathan Leaders.
Checked the log at ~/.mysql/workbench/log and found a few «permission denied» messages.

Now I can get mysql-workbench to work with:
sudo mysql-workbench

And later I can go and chmod the directories needing permission.

Kevin Bowen's user avatar

Kevin Bowen

19.2k55 gold badges76 silver badges81 bronze badges

answered Mar 4, 2017 at 7:22

Usman Suleman's user avatar

1

I ran this command and it fixed my issue:

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

Thanks to Jos for his answer here

answered Nov 16, 2021 at 16:05

Al Fahad's user avatar

Al FahadAl Fahad

2631 gold badge2 silver badges10 bronze badges

The hard data first:
Local machine: Xubuntu 17.10, with MySql-Workbench 6.3
Remote Machine: Ubuntu 16.04, with MySql-Client 5.7 and MySql-Server 5.7

The connection method is: Standard TCP/IP over SSH

The error:

Your connection attempt failed for user ‘root’ from your host to
server at 127.0.0.1:3306: Can’t connect to MySQL server on
‘127.0.0.1’ (111)

Then it gives me a list with things to check.

1 Check that mysql is running on server 127.0.0.1

check

2 Check that mysql is running on port 3306

check

3 Check the root has rights to connect to 127.0.0.1 from your address

I checked the mysql.user table and it says that root has the host: localhost and since MySql-Workbench does an ssh connect to the remote machine and then connects to the MySql-Server, localhost should be fine.
Nonetheless I tried setting the host to % as a wildcard but that didn’t change anything either so I switched back to default localhost.
I also checked the my.cnf. That is the entire content of it:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

There is no bind-address or skip-networking directive set.

4 Make sure you are both providing a password if needed and using the
correct password for 127.0.0.1 connecting from the host address you’re
connecting from

Password and stuff is all fine. Passwords are set, they are typed correctly when logging in.

When I do, what Workbench is supposed to do

  • ssh to the remote machine (ssh user@remotemachine)
  • login to mysql server (mysql -u root -p)

It works flawlessly
I just can’t do via MySql-Workbench

Help is much appreciated because I already tried everything I was able to research.



Я недавно установил MySQL 5 на Windows 2003 и попытался настроить экземпляр. Все работало нормально, пока я не добрался до «применения настроек безопасности», после чего он дал мне вышеуказанную ошибку (Can't connect to MySQL server on 'localhost' (10061)).

У меня есть исключение порта 3306 в моем брандмауэре для «MySQL Server».


14932  


18  

18 ответов:

вам, вероятно, придется предоставить привилегии «localhost» в таблице пользователю. Смотрите 'GRANT' синтаксис документации. Вот пример (из какого источника).

«предоставить все привилегии на %s.* для’%s’@ ‘localhost’, идентифицированного ‘%s’»;

Это самая распространенная проблема с MySQL.

кроме этого, вы можете проверить, что пользователь, которого вы определили для создания вашего экземпляра, имеет полные права, иначе пользователь не может предоставлять привилегии.

кроме того, убедитесь, что служба mysql запущена.

убедитесь, что у вас не включен сторонний брандмауэр или Служба безопасности Интернета.

кроме того, есть несколько страниц форума MySQL, посвященных этому:
http://forums.mysql.com/read.php?11,9293, 9609#msg-9609

попробуйте прочитать это.

получил эту ошибку на Windows, потому что мой mysqld.exe не работал.

побежал «C:Program FilesMySQLMySQL Server 5.5binmysqld» —install из командной строки, чтобы добавить его в мои службы, запустите службы.msc (start -> run), нашел службу MySQL и запустил ее.

не пришлось беспокоиться об этом оттуда.

чтобы решить эту проблему:

  1. идем в Диспетчер задач
  2. выберите вкладку Услуги
  3. найти службу MySql
  4. под управлением

вот и все.

У меня были трудности с доступом к MySQL при подключении через соединение localhost на стандартном порту 3306, который отлично работал, когда я установил и настроил его для предыдущих классов, которые я взял в MySQL и Java. Я получал ошибки, такие как» ошибка 2003 «и»не удается подключиться к серверу MySql на localhost (10061)». Я попытался подключиться как из MySQL Workbench (5.2.35 CE), так и из Netbeans (7.2). Я использую Windows 7 64 bit professional.

Я попытался ввести службы.msc в самом начале окно поиска меню, которое открыло диалоговое окно службы, чтобы показать все службы, установленные в windows. Я прокрутил вниз к MySQL и запустил эту службу. Последующие попытки подключиться к MySQL из MySQL WorkBench и из командной строки завершились успешно.

  1. убедитесь, что ваш хост-файл windows (расположен по адресу c://windows/system32/drivers/etc.host) имеет следующие линии. Если нет, добавьте его в конце

    127.0.0.1 localhost
    ::1 localhost
    
  2. иногда mysql не может вызвать Windows для принудительного запуска служб хоста, если брандмауэр блокирует его, поэтому запустите его вручную

win+выполнить>>услуги.msc, выберите «MySQL_xx», где» xx » — это имя, которое вы назначили службам хоста MySQL во время установки. Нажмите на кнопку «начать», чтобы начать с гиперссылки появился на левой стороне.

Я попробовал решение Kuzhichamadam Inn и обнаружил, что необходимо внести небольшое изменение.

MYSQL57 был сетевой службой. Я пробовал это неоднократно без успеха. Когда я открыл службы.msc я нашел другой сервис для localhost: MySQL. Я начал это с помощью процесса ниже, и это сработало.

выполнить > Services.МСЦ > правой кнопкой мыши по MySQL > «свойства» >в начало

пресс клавиша Windows + R
напишите » услуги.МСЦ» введите
ищите «MYSQL56»
напишите нажмите на нее и Запустите сервис

для локального подключения к MySql, вам не нужно настраивать брандмауэр с входящими правилами. Но даже если вы уже установка iptables разрешить TCP входящий порт 3306 и предоставить привилегию пользователю для доступа к БД локально, вы, возможно, придется настроить адрес привязки в вашем my.cnf файл, отредактируйте там адрес по умолчанию и поместите IP-адрес сервера, на котором работает MySql сервис.

run > services.msc > rightclick MySQL57 > properties >set start type option to automatic

после перезагрузки компьютера

At cmd

cd: C:

C :> cd "C:Program FilesMySQLMySQL Server 5.7bin"

станет

C:Program FilesMySQLMySQL Server 5.7bin>

тип mysql -u root -p

ie C:Program FilesMySQLMySQL Server 5.7bin> mysql -u root -p

введите пароль: ****

вот и все

это приведет к

mysql>

Я получил эту ошибку, когда у меня закончилось место на моем диске.

на выполнить тип services.msc. проверьте, работают ли Службы MySQL. Если нет, запустите его вручную. После его запуска введите MySQL Show для тестирования сервиса.

другая возможность:

существует два способа подключения клиента MySQL к серверу: через TCP/IP или с помощью сокетов. Возможно, у вас есть сервер MySQL, настроенный для поддержки сокетных соединений, но не сетевых соединений.

ничего не делать просто «сбросить по умолчанию» настройки брандмауэра он начнет работать.

Я прочитал много решений, но ничего не работало должным образом, поэтому, наконец, я сбросил настройки брандмауэра, которые работали.

наконец-то решил эту проблему.. попробуйте запустить mysql в xammp. Флажок mysql в xammp должен быть снят. тогда начинай. после этого вы можете открыть mysql, и теперь он будет подключаться к localhost

отредактируйте свой ‘ my-default.ini ‘ файл (по умолчанию он поставляется с комментариями свойств), как показано ниже ie.

basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888

есть очень хорошая статья представит, что диктует команды для создания пользователя, просматривать таблицы и т. д. т. е.

http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1

Так как я боролся и нашел немного другой ответ вот он:

недавно я переключил локальный сервер (интрасеть) на своем новом рабочем месте. Установлена лампа; Debian, Apache, MySql, PHP. Пользователи на работе подключают сервер с помощью имени хоста, позволяет называть его «intaserv». Я настроил все, получил его работу, но не смог подключить Мой MySql удаленно, что бы я ни делал.

Я нашел свой ответ после бесконечных попыток, хотя. вы можете иметь только один привязать-адрес и он не может быть имя хоста, в моем случае «интранет».

Это должен быть IP-адрес, например. «bind-address=192.168.0.50».

Anglais:

  • нажмите клавишу windows + R
  • пишем «Services.msc » затем нажмите Enter
  • поиск MySQL57 и щелкните правой кнопкой мыши
  • нажмите на кнопку запустить службу

Français:

  • Appuyez sur la touche Windows + R
  • Écrire «услуги.msc » Puis appuyez sur Entrée
  • Recherchez MySQL57 et clic droit
  • Cliquez sur rédémarrer
  1. щелкните правой кнопкой мыши на моем компьютере
  2. нажмите на управление
  3. перейти к службам и приложениям
  4. выберите службы и найдите MySQL service
  5. Правой Кнопкой Мыши на MySQL и выберите Start

Oracle website seems to imply it only works on 15 and 14.
http://dev.mysql.com/downloads/workbench/

Also two of my Ubuntu 16.04 machines don’t seem to be able to connect (Access is Denied errors for root)

Picture

It installs okay. It opens okay. But it won’t connect to localhost.

Anyone have any luck?

asked May 16, 2016 at 23:34

Jonathan's user avatar

JonathanJonathan

3,8345 gold badges29 silver badges51 bronze badges

5

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 16.04. This important caveat is documented in the 16.04 release notes:

Password behaviour when the MySQL root password is empty has changed.
Packaging now enables socket authentication when the MySQL root
password is empty. This means that a non-root user can’t log in as the
MySQL root user with an empty password.

For whatever reason, the MySQL Workbench that came with 16.04 doesn’t work out of the box with MySQL server, at least for me. I tried using «Local Socket/Pipe» to connect in a number of different ways but to no avail.

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. If you’ve attempted some other method to fix the issue, you’ll want to make sure the «plugin» field in mysql.user is set to «auth_token», which may require using mysqld_safe to log in to MySQL in the event you’ve been tinketing with things, like I did.

Credit to Miguel Nieto’s blog post for this solution.

answered Jun 3, 2016 at 1:46

Mike M's user avatar

Mike MMike M

6114 silver badges2 bronze badges

6

MySQL 5.7 and up don’t support connecting as «root» in mysql-workbench so you must create a normal user and connect via that.

sudo mysql -u root -p

Create a user named «admin» and use that to connect in mysql-workbench.

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

answered Jul 1, 2016 at 21:55

Jonathan's user avatar

JonathanJonathan

3,8345 gold badges29 silver badges51 bronze badges

6

This question might be two years old but my work with mysql-workbench tonight seems to have given me the answer to it.

root user now users auth_socket authentication by default. The only way root can gain access is by being logged in as root.

I found this out by running mysql -u root both as root user and standard user.

It would not work under standard user.

So my next question was — what user does mysql-workbench run as. Turns out it runs as standard user by default. To get it to run as root user it has to be run from root. So I went into root user CLI and type ‘mysql-workbench’.

I then had to go into the settings for the root user as shown here. The file location is valid for an ubuntu 18.04 installation.

Root connection settings mysql-workbench.

If that socket location is invalid then you’ll need to go into the mysql CLI from root or sudo and run the following command.

MySQL CLI command to find the socket.

After you have the correct settings test the connection. It should be successful and you’re ready to go.

abu_bua's user avatar

abu_bua

10.5k10 gold badges45 silver badges63 bronze badges

answered Sep 26, 2018 at 14:36

George Tasker's user avatar

3

Create an user account with appropriate administrative privileges that can connect via mysql workbench using the auth_socket plugin. Note that this does not work for root connections to the mysql server.

Logon to mysql from a terminal session:

$sudo mysql

If you are able to do this then the auth_socket plugin is enabled and the root account is authenticating using this plugin. Note that this is the default setup when installing mysql on ubuntu after having run the secure installation script.

First create a mysql user for your account ‘valerie’:

mysql> CREATE USER 'valerie'@'localhost' IDENTIFIED WITH auth_socket;

Enable administrative privileges for the account:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'valerie'@'localhost' WITH GRANT OPTION;

Exit the shell:

mysql> exit

Then in mysql workbench:

  1. Create a new connection
  2. Select the connection method as Local Socket/Pipe
  3. Set the Socket/Pipe Path to: /var/run/mysqld/mysqld.sock (note that this is the path for a Debian / Ubuntu system and changes for other flavors of Linux)
  4. Set the username (‘valerie’ in this example)

You should be able to then connect to the mysql server with this connection.

answered Aug 19, 2018 at 4:31

David's user avatar

DavidDavid

311 bronze badge

Try this

select mysql database

use mysql;
UPDATE user set plugin='mysql_native_password' where User='root';
flush privileges;
exit;

Then

sudo service mysql restart

zx485's user avatar

zx485

2,24711 gold badges24 silver badges34 bronze badges

answered Jul 21, 2019 at 20:25

URI's user avatar

Open terminal of your ubuntu system and enter below code,

In my ubuntu 20.04 os system it works fine, able to enter password and workbeanch working fine.

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

answered Jun 20, 2022 at 17:45

Daxesh Prajapati's user avatar

2

Works fine for me and I did nothing special. Installed mysql-server-5.7 and workbench both from command line and set up a user with a password and set up the normal database permissions (also with the normal method).

enter image description here

And with a database and table:

enter image description here

answered May 18, 2016 at 20:01

Rinzwind's user avatar

RinzwindRinzwind

294k41 gold badges570 silver badges712 bronze badges

1

If you are getting this error in Workbench then follow this steps.

First simply log in with your current password:

sudo mysql -u root -p

Then change your password because having low strength password gives error sometimes.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-strong-password';

FLUSH PRIVILEGES;

Then simply exit and again login with your new password:

quit

sudo mysql -u root -p

Once you successfully logged in type the command:

use mysql;

It should show a message like ‘Database changed’ then type:

UPDATE user SET plugin='mysql_native_password' WHERE User='root';

After that type:

UPDATE mysql.user set authentication_string=PASSWORD('new-strong-password') where user='root';

Then type:

FLUSH PRIVILEGES;

Then simply exit:

quit

Now try to log in with your new password in your WORKBENCH. Hope it will work. Thank you.

answered Apr 17, 2020 at 16:52

Tanmoy Bhowmick's user avatar

1

I had the same problem on newly installed 21.04 Ubuntu, after trying all these methods that didn’t quite work.

I tried to go into settings and allowed all the permissions and it worked for some reason.

Screenshot of the mysql setting

Greenonline's user avatar

Greenonline

2,0308 gold badges20 silver badges27 bronze badges

answered Oct 12, 2021 at 10:43

Keith John Smith's user avatar

2

MySQL server on AWS host running Ubuntu 16.04; mysql-workbench on Ubuntu 16.04 laptop; uses KeyPair connection.

After setting up Test db connection was working.
But the actual connection always failed with a message like the one posted by Jonathan Leaders.
Checked the log at ~/.mysql/workbench/log and found a few «permission denied» messages.

Now I can get mysql-workbench to work with:
sudo mysql-workbench

And later I can go and chmod the directories needing permission.

Kevin Bowen's user avatar

Kevin Bowen

19.4k55 gold badges76 silver badges81 bronze badges

answered Mar 4, 2017 at 7:22

Usman Suleman's user avatar

1

I ran this command and it fixed my issue:

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

Thanks to Jos for his answer here

answered Nov 16, 2021 at 16:05

Al Fahad's user avatar

Al FahadAl Fahad

2631 gold badge2 silver badges11 bronze badges

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

Понравилась статья? Поделить с друзьями:
  • Mysql workbench ошибка 1046
  • Mysql 1305 ошибка
  • Mysql installer accounts and roles ошибка
  • Mysql insert игнорировать ошибки
  • Mysql innodb проверка базы на ошибки