Sql 2003 error

This tutorial will explain how to solve “ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)” which occur when you try to access the MySQL.

This tutorial is intended to explain the necessary steps for solving the “ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)” which might occur when you try to access the MySQL database server.

Before moving any further, if you are a Linux user who is new to MySQL/MariaDB, then you may consider learning MySQL / MariaDB for Beginners – Part 1 and 20 MySQL (Mysqladmin) Commands for Database Administration in Linux as well.

On the other hand, if you are already a intermediate/experienced MySQL user, you can master these 15 Useful MySQL/MariaDB Performance Tuning and Optimization Tips.

Note: For this tutorial, it is assumed that you have already installed mysql database server.

Coming back to the point of focus, what are some of the possible causes of this error?

  1. Network failure especially if mysql database server is running on remote host.
  2. No mysql server is running on the mentioned host.
  3. Firewall blocking TCP-IP connection or other related reasons.

Below are the essential steps to deal with it.

1. If database server is on a remote machine, then try to test the client-server connectivity using ping command, for instance:

$ ping server_ip_address

Ping Host Machine

Ping Host Machine

Once there is connectivity, use the ps command below which shows information about a selection of the active processes, together with a pipe and grep command, to check that the mysql daemon is running on your system.

$ ps -Af | grep mysqld

where the option:

  1. -A – activates selection of all processes
  2. -f – enables full format listing

Check MySQL Process

Check MySQL Process

If there is no output from the previous command, start the mysql service as follows:

$ sudo systemctl start mysql.service
$ sudo systemctl start mariadb.service
OR
# sudo /etc/init.d/mysqld start

After starting mysql service, try to access the database server:

$ mysql -u username -p -h host_address  

2. If you still get the same error, then determine the port (default is 3306) on which the mysql daemon is listening by running the netstat command.

$ netstat -lnp | grep mysql

where the options:

  1. -l – displays listening ports
  2. -n – enables display of numerical addresses
  3. -p – shows PID and name of the program owning the socket

Find MySQL Port Number

Find MySQL Port Number

Therefore use the -P option to specify the port you see from the output above while accessing the database server:

$ mysql -u username -p -h host_address -P port

3. If all the above commands run successfully, but you still see the error, open the mysql config file.

$ vi /etc/mysql/my.cnf
OR
$ vi /etc/mysql/mysql.conf.d/mysqld.cnf 

Look for the line below and comment it out using the # character:

bind-address = 127.0.0.1 

Save the file and exit, afterwards restart the mysql service like so:

$ sudo systemctl start mysql.service
$ sudo systemctl start mariadb.service
OR
# sudo /etc/init.d/mysqld start

However, if you have firewallD or Iptables running try to review firewall services and open the mysql port, assuming it is firewall blocking TCP-IP connections to your mysql server.

That’s all! Do you know other methods or have suggestions for solving the MySQL connection error above? Let us know by dropping a comment via the feedback form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

MySQL — система управления базами данных (СУБД) с открытым исходным кодом от компании Oracle. Она была разработана и оптимизирована специально для работы веб-приложений. MySQL является неотъемлемой частью таких веб-сервисов, как Facebook, Twitter, Wikipedia, YouTube и многих других.

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

Не удаётся подключиться к локальному серверу

Одной из распространённых ошибок подключения клиента к серверу является «ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)».

Эта ошибка означает, что на хосте не запущен сервер MySQL (mysqld) или вы указали неправильное имя файла сокета Unix или порт TCP/IP при попытке подключения.

Убедитесь, что сервер работает. Проверьте процесс с именем mysqld на хосте сервера, используя команды ps или grep, как показано ниже.

$ ps xa | grep mysqld | grep -v mysqld

Если эти команды не показывают выходных данных, то сервер БД не работает. Поэтому клиент не может подключиться к нему. Чтобы запустить сервер, выполните команду systemctl.

$ sudo systemctl start mysql        #Debian/Ubuntu
$ sudo systemctl start mysqld       #RHEL/CentOS/Fedora

Чтобы проверить состояние службы MySQL, используйте следующую команду:

$ sudo systemctl status mysql       #Debian/Ubuntu
$ sudo systemctl status mysqld      #RHEL/CentOS/Fedora

Если в результате выполнения команды произошла ошибка службы MySQL, вы можете попробовать перезапустить службу и ещё раз проверить её состояние.

$ sudo systemctl restart mysql
$ sudo systemctl status mysql

Если сервер работает (как показано) и вы по-прежнему видите эту ошибку, вам следует проверить, не заблокирован ли порт TCP/IP брандмауэром или любой другой службой блокировки портов.

Для поиска порта, который прослушивается сервером, используйте команду netstat.

$ sudo netstat -tlpn | grep "mysql"

Ещё одна похожая и часто встречающаяся ошибка подключения — «(2003) Can’t connect to MySQL server on ‘server’ (10061)». Это означает, что в сетевом соединении было отказано.

Следует проверить, работает ли в системе сервер MySQL (смотрите выше) и на тот ли порт вы подключаетесь (как найти порт, можно посмотреть выше).

Похожие частые ошибки, с которыми вы можете столкнуться при попытке подключиться к серверу MySQL:

ERROR 2003: Cannot connect to MySQL server on 'host_name' (111)
ERROR 2002: Cannot connect to local MySQL server through socket '/tmp/mysql.sock' (111)

Ошибки запрета доступа в MySQL

В MySQL учётная запись (УЗ) определяется именем пользователя и клиентским хостом, с которого пользователь может подключиться. УЗ может также иметь данные для аутентификации (например, пароль).

Причин для запрета доступа может быть много. Одна из них связана с учётными записями MySQL, которые сервер разрешает использовать клиентским программам при подключении. Это означает, что имя пользователя, указанное в соединении, может не иметь прав доступа к базе данных.

В MySQL есть возможность создавать учётные записи, позволяющие пользователям клиентских программ подключаться к серверу и получать доступ к данным. Поэтому при ошибке доступа проверьте разрешение УЗ на подключение к серверу через клиентскую программу.

Увидеть разрешённые привилегии учётной записи можно, выполнив в консоли команду SHOW GRANTS
Входим в консоль (пример для Unix, для Windows консоль можно найти в стартовом меню):

В консоли вводим команду:

> SHOW GRANTS FOR 'tecmint'@'localhost';

Дать привилегии конкретному пользователю в БД по IP-адресу можно, используя следующие команды:

> grant all privileges on *.test_db to 'tecmint'@'192.168.0.100';
> flush privileges;

Ошибки запрещённого доступа могут также возникнуть из-за проблем с подключением к MySQL (см. выше).

Потеря соединения с сервером MySQL

С этой ошибкой можно столкнуться по одной из следующих причин:

  • плохое сетевое соединение;
  • истекло время ожидания соединения;
  • размер BLOB  больше, чем max_allowed_packet.

В первом случае убедитесь, что у вас стабильное сетевое подключение (особенно, если подключаетесь удалённо).

Если проблема с тайм-аутом соединения (особенно при первоначальном соединении MySQL с сервером), увеличьте значение параметра connect_timeout.

В случае с размером BLOB нужно установить более высокое значение для max_allowed_packet в файле конфигурации /etc/my.cnf в разделах [mysqld] или [client] как показано ниже.

[mysqld]
connect_timeout=100
max_allowed_packet=500M

Если файл конфигурации недоступен, это значение можно установить с помощью следующей команды.

> SET GLOBAL connect_timeout=100;
> SET GLOBAL max_allowed_packet=524288000;

Слишком много подключений

Эта ошибка означает, что все доступные соединения используются клиентскими программами. Количество соединений (по умолчанию 151) контролируется системной переменной max_connections. Устранить проблему можно, увеличив значение переменной в файле конфигурации /etc/my.cnf.

[mysqld]
max_connections=1000

Недостаточно памяти

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

Сначала нужно убедиться, что запрос правильный. Если это так, то нужно выполнить одно из следующих действий:

  • если клиент MySQL используется напрямую, запустите его с ключом --quick switch, чтобы отключить кешированные результаты;
  • если вы используете драйвер MyODBC, пользовательский интерфейс (UI) имеет расширенную вкладку с опциями. Отметьте галочкой «Do not cache result» (не кешировать результат).

Также может помочь MySQL Tuner. Это полезный скрипт, который подключается к работающему серверу MySQL и даёт рекомендации по настройке для более высокой производительности.

$ sudo apt-get install mysqltuner     #Debian/Ubuntu
$ sudo yum install mysqltuner         #RHEL/CentOS/Fedora
$ mysqltuner

MySQL продолжает «падать»

Если такая проблема возникает, необходимо выяснить, заключается она в сервере или в клиенте. Обратите внимание, что многие сбои сервера вызваны повреждёнными файлами данных или индексными файлами.

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

$ sudo systemctl status mysql       #Debian/Ubuntu
$ sudo systemctl status mysqld      #RHEL/CentOS/Fedora

Чтобы узнать время безотказной работы сервера, запустите команду mysqladmin.

$ sudo mysqladmin version -p 

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

$ sudo mysqladmin -i 5 status

Или

$ sudo mysqladmin -i 5 -r status

Заключение

Самое важное при диагностике — понять, что именно вызвало ошибку. Следующие шаги помогут вам в этом:

  • Первый и самый важный шаг — просмотреть журналы MySQL, которые хранятся в каталоге /var/log/mysql/. Вы можете использовать утилиты командной строки вроде tail для чтения файлов журнала.
  • Если служба MySQL не запускается, проверьте её состояние с помощью systemctl. Или используйте команду journalctl (с флагом -xe) в systemd.
  • Вы также можете проверить файл системного журнала (например, /var/log/messages) на предмет обнаружения ошибок.
  • Попробуйте использовать такие инструменты, как Mytop, glances, top, ps или htop, чтобы проверить, какая программа использует весь ресурс процессора или блокирует машину. Они также помогут определить нехватку памяти, дискового пространства, файловых дескрипторов или какого-либо другого важного ресурса.
  • Если проблема в каком-либо процессе, можно попытаться его принудительно остановить, а затем запустить (при необходимости).
  • Если вы уверены, что проблемы именно на стороне сервера, можете выполнить команды: mysqladmin -u root ping или mysqladmin -u root processlist, чтобы получить от него ответ.
  • Если при подключении проблема не связана с сервером, проверьте, нормально ли работает клиент. Попробуйте получить какие-либо его выходные данные для устранения неполадок.

Перевод статьи «Useful Tips to Troubleshoot Common Errors in MySQL»


When you are working with a MySQL database, you might run into this error:

2003 - Can't connect to MySQL server on '127.0.0.1' (or some other host)

There might be several causes for that error, so you can try these methods to find out what the problem is.

1. Check for typos

A small typo in the MySQL server name, database name, username, port, etc. can lead to this error, so make sure you got them right 100%.

2. Make sure MySQL server is running

Maybe the problem is that there is no MySQL server running at the specified host. So the first thing you should do is to verify the status of MySQL Server. It’s recommended to try restarting the MySQL server.

You might need to check the port that it’s listening to, the default port is 3306.

If you are using DBngin to manage the local server, launch DBngin and see if the server is still on. If not, start it.

DBngin

3. Connection to the MySQL server is not allowed using TCP/IP

You need to make sure that your MySQL server was not started with the --skip-networking option. You should find the setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux).

If it was, remove it and restart MySQL server for the change to take effect.

For remote connections, you need to confirm that MySQL remote access is enabled. By default, MySQL listens for connections only from localhost. Go check the MySQL configuration file and give the bind-address as the IP address of the server where MySQL service listens.

You could also try increasing the max_connection parameter in the MySQL configuration file.

4. There is a networking issue blocking access to MySQL

It could be a network firewall blocking the connection. Most often it will help to uninstall and reinstall the firewall.

5. Still no help at all?

If you tried all above and none of them worked, try connecting using SSH Tunnelling instead and see if it helps.

For more information, visit MySQL Reference Manual.


Need a good MySQL GUI? TablePlus provides a native client that allows you to access and manage MySQL and many other databases simultaneously using an intuitive and powerful graphical interface.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

Need a quick edit on the go? Download for iOS

TablePlus in Dark mode

Ads were blocked — no problem. But keep in mind that developing HeidiSQL,
user support and hosting takes time and money. You may want to
send a donation instead.

I try to use Heidi Portable , try and with 6.0 stable but nothing same problem I try to use Windows XP and Windows 7 I check twice the ssh tunel and plink.exe file and same error I try and on virtual pc but nothing :(
Please help me this work on my friends PC-s they also try to help me I install mysql I know it’s not in requarements but nothing. I use new localhost file but nothing try to install xaamp but he don’t fix the problem please help me.

Adding some commas and dots for readers would be really cool man :)

So, you have a locally installed server and on the same pc you want to use HeidiSQL? Just stick to «MySQL (TCP/IP)» connection, use «localhost» and «3306» as the right port. And, ensure the server is really running.

Thank You.
Sorry abut commas and dots.smileI will try to fix that i future.
I need to use localhost because my server need to be logged from SSH tunel.
I also alredy install XAMPP and mysql service running try to connect using php and apache return Connected successfully.
But I still can’t log in to Heidi SQL using 127.0.0.1 or localhost.
Please give me some advice how to fix this :(
Thank You in advance I think I need to have mysql before connect to my server using ssh tunel ? or ?

When I use 127.0.0.1 don’t work but when I try with localhost work fine to conect using php …

I get this message when trying to connect over SSH tunnel. The same settings/user/pass work via command line and using MySQL bench.
This is only happening on certain servers, via SSH works fine on others.

xxX.. «then i connect it Say same» — what is that supposed to mean ? english it isn´t.
what user name / password do you not know ?
if you don´t know your database´s u/p, ask your provider.
If you don´t know SSH access u/p, ask your provider.
If you dont´know which u/p to type into one of HeidiSQL´s dialogs, specify dialog (session manager?) and page title (headers on top right of session manager).

PS: calm down. this is not a kid´s playground. Using more than one exclamation point per sentence, or more than one emoticon per entry, will nearly guarantee that your post is either a) completely disregarded, or b) meets with an unfavorable response.

Hey Plz help me out with this error->
SQL ERROR(2003): Can’t connect to MySQL server on localhost(10061)

No server installed on your local machine?

I have installed apache , but still its showing an error

Eh, so you have installed Apache, a webserver. Where did you read HeidiSQL can connect to Apache? You need MySQL, not Apache.

I laughed entirely too hard at this. :)

xxXxxrbj, if you do give more information on what exactly your problem is, nobody will be able to help you. «dont know what is the user name and the password» is not sufficient.

its say SQL Error (2003): Can’t connect to MySQL server on ‘localhost’ (10061)

Also, not hijacking other threads is probably a good start.

If the server is running and you have forgotten your username and password you can reset the root password.

@xxXxxrbj: Again, you are providing almost no information of value.

Let me try and make it clear:

* We know nothing about the server you are connecting to.

* We have no idea what username you are connecting with.

* We have no idea what your password might be, even if we knew the user (how could we know?).

* I have already given you a link to locally reset your root MySQL password.

* Your question has NOTHING to do with HeidiSQL specifically.

What else do you propose we do to help you?

to start:
what type of database server are you using ? do you run it yourself on one of youtr machines, or are you using a server of your internet provider ?
what method is set in heidisql to access this server ? tcp/ip, ssh tunnel, or what ?

I too ran into (2003)/(10061).

TL;DR: in my case, to resolve this error, I first had to run «plink root@myvps.example.com» once on my local computer in order to have my VPS’ host key to plink’s key cache.
—————————
Full report
—————————

Scenario: Using HeidiSQL, I want to connect to my VPS’s MySQL database via an SSH tunnel.
Context: My VPS already has a MySQL server running. It has a MySQL user «root».

So using HeidiSQL, under Session manager:
On tab «Settings»:
*Network type: MySQL (SSH tunnel)
Hostname / IP: myvps.example.com
*User: root
*Password: rootMYSQLpassword
*Port: 3306
*Compressed client/server protocol: unselected

On tab «SSH tunnel»:
*plink.exe location: C:Program Files (x86)plink.exe (… I’ve put plink.exe at this location)
*SSH host + port: myvps.example.com … port: 22
*Username: root
*Password: rootSSHpassword

I clicked «Save», then «Open».

I got the following error message:
—BEGIN—
SQL Error (2003): Can’t connect to MySQL server on ‘localhost’ (10061)
—END—-

Running «plink root@myvps.example.com» on my computer’s command line gave me the following information:
—BEGIN—
The server’s host key is not cached in the registry. You have no guarantee that the server is the computer you think it is.
The server’s rsa2 key fingerprint is:
ssh-rsa 2048 my:personal:hex
If you trust this host, enter «y» to add the key to PuTTY’s cache and carry on connecting.
If you want to carry on connecting just once, without adding the key to the cache, enter «n». If you do not trust this host, press Return to abandon the connection.
Store key in cache? (y/n) y
Using username «root».
—END—-

So I provided «y».
Back in HeidiSQL and clicking «Open» again, now I was no longer given «SQL Error (2003)»!
But now I got a new error message:
—BEGIN—
SQL Error (1130): Host ‘myvps.example.com’ is not allowed to connect to this MySQL server
—END—-

In my specific case, my MySQL server’s user «root» only had the privilege to connect to MySQL from «localhost», from «::1», and from «127.0.0.1». Therefore, I had to provide my MySQL user «root» the privilege to connect to the MySQL database from «myvps.example.com». To do so, I ssh’d on my VPS, then on my VPS’ shell:
—BEGIN—
(on the server shell)
mysql -p
(After providing my MySQL root user’s MySQL password, I am now on the mysql client shell… recognizable by «mysql>». Now provide the mysql client shell the following command)
grant all privileges on *.* to ‘root’@’myvps.example.com’ identified by ‘rootMYSQLpassword’;
—END——

Back at HeidiSQL, try «Open» once again. In my case, everything worked well now. I can successfully connect from HeidiSQL via SSH to my VPS’ MySQL database.

I too ran into (2003)/(10061).

TL;DR: in my case, to resolve this error, I first had to run «plink root@myvps.example.com» once on my local computer in order to have my VPS’ host key to plink’s key cache.
—————————
Full report
—————————

Scenario: Using HeidiSQL, I want to connect to my VPS’s MySQL database via an SSH tunnel.
Context: My VPS already has a MySQL server running. It has a MySQL user «root».

So using HeidiSQL, under Session manager:
On tab «Settings»:
*Network type: MySQL (SSH tunnel)
Hostname / IP: myvps.example.com
*User: root
*Password: rootMYSQLpassword
*Port: 3306
*Compressed client/server protocol: unselected

On tab «SSH tunnel»:
*plink.exe location: C:Program Files (x86)plink.exe (… I’ve put plink.exe at this location)
*SSH host + port: myvps.example.com … port: 22
*Username: root
*Password: rootSSHpassword

I clicked «Save», then «Open».

I got the following error message:
—BEGIN—
SQL Error (2003): Can’t connect to MySQL server on ‘localhost’ (10061)
—END—-

Running «plink root@myvps.example.com» on my computer’s command line gave me the following information:
—BEGIN—
The server’s host key is not cached in the registry. You have no guarantee that the server is the computer you think it is.
The server’s rsa2 key fingerprint is:
ssh-rsa 2048 my:personal:hex
If you trust this host, enter «y» to add the key to PuTTY’s cache and carry on connecting.
If you want to carry on connecting just once, without adding the key to the cache, enter «n». If you do not trust this host, press Return to abandon the connection.
Store key in cache? (y/n) y
Using username «root».
—END—-

So I provided «y».
Back in HeidiSQL and clicking «Open» again, now I was no longer given «SQL Error (2003)»!
But now I got a new error message:
—BEGIN—
SQL Error (1130): Host ‘myvps.example.com’ is not allowed to connect to this MySQL server
—END—-

In my specific case, my MySQL server’s user «root» only had the privilege to connect to MySQL from «localhost», from «::1», and from «127.0.0.1». Therefore, I had to provide my MySQL user «root» the privilege to connect to the MySQL database from «myvps.example.com». To do so, I ssh’d on my VPS, then on my VPS’ shell:
—BEGIN—
(on the server shell)
mysql -p
(After providing my MySQL root user’s MySQL password, I am now on the mysql client shell… recognizable by «mysql>». Now provide the mysql client shell the following command)
grant all privileges on *.* to ‘root’@’myvps.example.com’ identified by ‘rootMYSQLpassword’;
—END——

Back at HeidiSQL, try «Open» once again. In my case, everything worked well now. I can successfully connect from HeidiSQL via SSH to my VPS’ MySQL database.

Registered just so say that this worked beautifully for me!
Thanks a bunch! =D

@jwanglof : Thanks! :)

Two more facts for this to work:
* In case you run into «SQL Error (1045): Access denied for user…@…(using password: YES)», then make sure that on the «SSH tunnel» tab, you provide a unique port which does not collide with any ports running on your local machine. Especially prefer to use another port if there is already an (additionally independent) MySQL server running on your local machine which already listens on port 3306.

* Make sure that on the «Advanced» tab, option «Use SSL» is unselected. In the default situation, when network type «MySQL (SSH tunnel)» is selected, this option is greyed out and unselected. But due to misconfiguration of my session name/profile, the «Use SSL» option was selected and greyed out. To unselect it again, first change network type to «MySQL (TCP/IP)», unselect the «Use SSL» option, then change network type back to «MySQL (SSH tunnel)».

helo everyone.., I too experience this problem…, when i open run my heideSQL but i cannot access my database… an error message prompted «SQL Error (2003): Can’t connect to MySQL server on ‘127.0.0.1’ (10061)».

please help me!

hello everyone,

i need help for my heidiSQL.

my database worked yesterday but im now experiencing this error. the error message goes this way «SQL Error (2003): Cant connect to MySQL server on ‘127.0.0.1’ (10061)». i tried reinstall the SQL but still the problem goes on. how could i solve this one. im new and i need some vivid explanation.

thanks a lot.

Helo, sorry for my english
I Use XP. my server is MariaDB.
I try to connect with Heidi in a local PC. The connection error is with both, putting localhost or 127.0.0.1
user: root
pass: (blank)
How I correct this error?

I ran into error (2003)/(10061) for another reason:

My client computer had been running for quite some time, with a few HeidiSQL crashes in between.

I assume that one of these crashed HeidiSQL instances had hogged some of my client computer’s port used for connecting to the remote server.

One solution to again successfully connect to the remote server was to restart my client computer. Probably, there are «nicer» solutions such as freeing the hogged port.

I face one error at the time of open the Heidi shortcut like,

SQL Error (2003) in statement #0;Can’t connect to MySQL server on ‘10.125.63.10’(10061)

[/b]
So please help me to start the Heidi…..

Helo, sorry for my english
I Use XP. my server is MariaDB.
I try to connect with Heidi in a local PC. The connection error is with both, putting localhost or 127.0.0.1
user: root
pass: (blank)
How I correct this error?

toc…toc
nobody can help me?

I know people still get this error, I registered just so I could reply.

Check your MySQL conf (my.cnf) and make sure your Bind Address isn’t set on local host(127.0.0.1). Be sure to change this to your server’s external IP if you’re trying to connect remotely

Not sure, but i suppose you should try putting localhost/127.0.0.1 in your «Hostname» field, because it´s through SSH tunnel you are connecting, and threrefor to the system it looks like a local connection.


So using HeidiSQL, under Session manager:
On tab «Settings»:
*Network type: MySQL (SSH tunnel)
Hostname / IP: localhost or 127.0.0.1
*User: root
*Password: rootMYSQLpassword
*Port: 3306
*Compressed client/server protocol: unselected

I am having the same problem, running linux mint 17, in the xampp (lampp) environment. I’m running both heidisql standard, and also portable, both under wine. This behavior suddenly started. Getting «SQL Error (2003) in statement #0: Can’t connect to MySQL server on ‘localhost’ (10061)». I’m running XAMPP (called ‘lampp’ in Linux); apache, mysql, and php are all running. I am able to connect to my MySQL databases using a terminal. My web site connects OK and displays all the database info. Phpmyadmin connects OK, and I’m able to issue SQL commands ok. No, only HeidiSQL is acting up.

The dropdown ‘databases’ list box is empty.

do ps aux|grep mysql to check which configuration file mysqld uses on your system (—defaults-file= argument, often /etc/mysql/my.cnf). Check the [mysqld] setion of this file for a) a line containing

skip-networking

if present, comment it out (ie #skip-networking); and b) a line

bind-address=xxxx

if not present, add bind-address=0.0.0.0
if present but different behind the =, change to bind-address=0.0.0.0

then restart mysqld process (service mysql restart, /etc/init.d/mysql restart, or other depending on your system — if in doubt reboot).

if this should not work, also try

bind-address={your servers external ip address}

TYVM jfalch!!! smile

For some reason I had un-commented skip-networking; re-commented it and heidisql works.

btw ps aux | grep mysqld output didn’t show the location of my.cnf, but I found it after little hunting. It’s in /opt/lampp/etc/ — xampp resides in /opt/lampp in Linux.

-sadhu!

fine.

concerning my.cnf: seems to be depending on the distro wether the starting call for mysqld has an explicit —defaults-file= param or not; if not, it will use some default path compiled into the mysqld binary …

This thread is pretty old, but is still one of one of the top google results for this issue in 2018!

I finally found out what my issue was with regards to HeidiSQL not connecting to MySQL via SSH.

It appears that my Unix VM (what I SSH to) was delaying login and because plink.exe is in silent mode I imagine that HeidiSQL does not wait for the login proccess to finish before it fires off the MySQL connect command thus HeidiSQL returns a «can’t connect to MySQL server on ‘localhost’ (10061)».

However, if you execute plink.exe to output verbose mode by putting «-v» into the parameters, this either slows HeidiSQL or plink down enough to allow it to connect to MySQL.

I did find some conclusions that «reverse DNS lookups» or «GSSAPI authentication» were causing the delayed login to the Unix server. However I’m not a Unix specialist and decided its not worth the effort to try and fix that since I have a work around that works.

Hope this helps.

try
sudo service mysqld restart

It works for me :)

Please login to leave a reply, or register at first.

Stuck with AWS “ERROR 2003 (HY000) Can’t connect to MySQL server”? We can help you.

Often when a MySQL client tries to connect to MySQL server over AWS cloud, mysql-server sends back the error.

Here at Bobcares, we often handle requests from our customers to fix similar errors as a part of our Server Management Services. Today we will see how our support engineers fix this for our customers.

How to fix AWS ERROR 2003 (HY000) Can’t connect to MySQL server

Before going into the steps for fixing this error we will see what causes this error.

A typical error may look like the one given below:

RDS : ERROR 2003 (HY000): Can’t connect to MySQL server (10060)

Causes

This error states that the inbound/outbound traffic from the AWS instance is not reachable to the current host where the MySQL client is running. So first a user needs to register the public IP address in the RDS security groups to get access over the RDS MySQL instance.

Steps to fix this error

Configuring public IP address in security groups will fix “RDS : ERROR 2003 (HY000): Can’t connect to MySQL server (10060)”.

Following are the steps to configure public IP addresses in security groups:

1. First, we must find the public IP address for our host machine where we are running mysql-client.

2. Then go to the security groups and add the public IP address for inbound traffic.

3. After that we will add the same entry for outbound traffic distributed by AWS services.

4. Once we complete the above entries we can refresh the security groups and test the connection from any mysql-client.

For example, we can test the connection by simply typing the below command from any terminal where MySQL is configured:

 mysql -h host-public-ip/DNS -P 3306 -u username -p password

[Need assistance? We can help you]

Conclusion

In short, we saw how our Support Techs fix AWS “ERROR 2003 (HY000): Can’t connect to MySQL server” for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Понравилась статья? Поделить с друзьями:
  • Sql error 42704
  • Spyhunter ошибка вызова функции скрипта установки
  • Sql error 42703 ошибка столбец не существует
  • Spyhunter 5 ошибка при создании скрипта конфигурации установки
  • Sql error 42703 error column does not exist