I just installed mariadb on my parrot sec and I tried sudo mysql_secure_installation
here is the output :
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
I also tried mysql -v
and it gives the same error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
and here is the output for systemctl start mariadb
:
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
and here is the output for systemctl status mariadb.service
:
● mariadb.service - MariaDB 10.5.8 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-02-14 21:14:29 +01; 2min 13s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 212070 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 212071 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 212073 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 212121 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 212121 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
CPU: 182ms
I’m trying to install mysql for the first time on aws linux instance running the following commands
sudo yum install mysql-server
sudo mysql_secure_installation
As soon as I run the second command I get
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Enter current password for root (enter for none):
And I haven’t even set my root password. How am I supposed to enter a password which I haven’t set in the first place?
asked Feb 15, 2017 at 6:01
8
—-List installed mysql
sudo yum list installed | grep mysql
—-Remove all
sudo yum remove mysql-client mysql-server mysql-common mysql-devel
delete some conf files manually :
sudo rm -rf /var/lib/mysql/
sudo rm -rf /etc/my.cnf
Try to reinstall
sudo yum install mysql mysql-server
get the autogenerated password
sudo grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
use the autogen password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Hope it solve your problem .
https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/linux-installation-yum-repo.html
answered Feb 15, 2017 at 6:37
2
- Печать
Страницы: [1] 2 Все Вниз
Тема: Не запускается MYSQL на сервере (Прочитано 3836 раз)
0 Пользователей и 1 Гость просматривают эту тему.

Seresigo
Доброго времени суток! Проблема вытекает из темы. не могу понять в чем проблема. Появилось после перезагрузки системы
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysq● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
l database server daemon
dor preset: enabled)
2017-10-30 20:37:26 MSK; 14min ago
art (code=exited, status=1/FAILURE)
: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' res
: [61B blob data]
: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (
: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
:
!
ce: Control process exited, code=exited status=1
tart LSB: Start and stop the mysql database server daemon.
ce: Unit entered failed state.
ce: Failed with result 'exit-code'.
« Последнее редактирование: 30 Октября 2017, 20:55:07 от Seresigo »

Pretender155
No such file or directory
так написал же тебе «нету файла или папки» проверь есть нет папка эта и права какие на ней

Seresigo
файла нет, какие настройки нужны для него?

victor00000

Seresigo
ls -dl /var/run/
?
drwxr-xr-x 25 root root 840 ноя 1 23:02 /var/run/

victor00000
не знаю,
что тебя надо переустановка для мусял? я могу команды.

bezbo
netstat -ln | grep mysqld

Seresigo
не знаю,
что тебя надо переустановка для мусял? я могу команды.
да если можно)
Пользователь добавил сообщение 01 Ноября 2017, 23:48:20:
netstat -ln | grep mysqld
так тоже не запускает
« Последнее редактирование: 01 Ноября 2017, 23:48:20 от Seresigo »

EvangelionDeath
Можете подсказать,что Вы делали до перезагрузки?)
А то у вас MariaDB, а не MySQL
HP Pro 840 G3: Intel i5-6300U, 32GB DDR4 2133MHz, Intel 520, Intel Pro 2500 180GB/Ubuntu 22.04
Dell Latitude 5590: Intel i5-8350U, 16GB DDR4 2400MHz, Intel 620, Samsung 1TB/Ubuntu 22.04

Seresigo
Можете подсказать,что Вы делали до перезагрузки?)
А то у вас MariaDB, а не MySQL
Как раз последним действием была установка MariaDB, потом выключили свет и все. Перезагрузился и не могу подключиться(
Пользователь добавил сообщение 02 Ноября 2017, 00:31:25:
service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Ср 2017-11-01 23:47:01 MSK; 43min ago
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Ср 2017-11-01 23:47:01 MSK; 43min ago
Docs: man:systemd-sysv-generator(8)
ноя 01 23:47:01 server /etc/init.d/mysql[2302]: [61B blob data]
ноя 01 23:47:01 server /etc/init.d/mysql[2302]: error: 'Can't connect to local MySQL server
ноя 01 23:47:01 server /etc/init.d/mysql[2302]: Check that mysqld is running and that the so
ноя 01 23:47:01 server /etc/init.d/mysql[2302]:
ноя 01 23:47:01 server mysql[656]: ...fail!
ноя 01 23:47:01 server systemd[1]: mysql.service: Control process exited, code=exited status
ноя 01 23:47:01 server systemd[1]: Failed to start LSB: Start and stop the mysql database se
ноя 01 23:47:01 server systemd[1]: mysql.service: Unit entered failed state.
ноя 01 23:47:01 server systemd[1]: mysql.service: Failed with result 'exit-code'.
ноя 01 23:49:46 server systemd[1]: Stopped LSB: Start and stop the mysql database server dae
~
« Последнее редактирование: 02 Ноября 2017, 00:31:53 от Seresigo »

victor00000
Seresigo,
скрипт в файл — http://paste.ubuntu.com/25868263/
команды.
1.
удалить установку.
sudo ./mysql-ri.sh -r
2.
и установка и пароль 12345.
sudo apt-get update
если небыло 1. на 2. и снова 1. и 2.
sudo ./mysql-ri.sh -i 12345
mysql -uroot -p12345
?

Seresigo
mysql -uroot -p12345
на первой выдает нет файла его создать надо?
root@server:/home/setup# ./mysql-ri.sh -r
bash: ./mysql-ri.sh: No such file or directory
« Последнее редактирование: 02 Ноября 2017, 19:50:37 от Seresigo »

victor00000
chmod +x ./mysql-ri.sh
и дальше.

Seresigo
chmod +x ./mysql-ri.sh
chmod: cannot access ‘./mysql-ri.sh’: No such file or directory

victor00000
find / -name "mysql-ri.sh" 2>/dev/null
?
- Печать
Страницы: [1] 2 Все Вверх
This is NOT a duplicate of Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
The issue there was of insufficient disk space. No such problem here.
I have a mysql setup on a Redhat Centos 5.5 system, which was working fine until I restarted it.
The webapplication spits out:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
when trying to connect to it.
I’m not able to run:
root@server [~]# /usr/bin/mysql_secure_installation
...
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Irrespective of what I enter (root password, earlier mysql password, or blank), it still says the same thing.
Also:
root@server [~]# cat /var/log/mysqld.log
101021 18:37:34 mysqld ended
Edit1: After doing service mysqld restart
101022 00:43:46 mysqld started
101022 0:43:46 InnoDB: Started; log sequence number 0 2820714
101022 0:43:46 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.77' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
Home
> mySQL troubleshooting > mysql_secure_installation showed ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Today, I secured the mysql db with the mysql_secure_installation. It showed the following errors.
root@slave1 mysql]# ./bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Enter current password for root (enter for none):
Caused:
Since I have set the mysqld socket to /opt/mysql/run/mysqld.sock in /etc/my.cnf as the following, not the default path /tmp/mysql.sock.
[mysqld]
# basic setting
datadir = /opt/mysql/data
tmpdir = /opt/mysql/tmp
socket = /opt/mysql/run/mysqld.sock
Fixed:
I added one more line “/opt/mysql/run/mysqld.sock” into /usr/local/mysql/bin/mysql_secure_installation at make_config section as the following. Then the problem got fixed.
sub make_config {
my $password = shift;
my $esc_pass = basic_single_escape($rootpass);
write_file($config,
“# mysql_secure_installation config file”,
“[mysql]”,
“user=root”,
“password=’$esc_pass’”,
“connect-expired-password”,
“socket=/opt/mysql/run/mysqld.sock”);
}
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
hacdias opened this issue
Aug 3, 2016
· 33 comments
Comments
Hello!
I’m trying to install MySQL on Bash on Ubuntu on Windows. I’m running bash as admin and run sudo apt-get install mysql-server
. In the middle of the installation I can find this:
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of stop.
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
And when I start mysql, I get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Are this sockets not supported yet or am I doing something wrong?
Thanks!
I had this issue as well. MySQL is installed but could not be run automatically. You can start MySQL with this command:
sudo /etc/init.d/mysql start
aderchox, prakash-simhandri, KuczaRacza, axelpreeo, salimHarthi, Silviatulli, imomer, victorftrdba, NotAProton, kazuki-fujiwara-en, and 2 more reacted with thumbs down emoji
francoqueirolo, alphanetEX, CodeManJay, Sherlock323, FireLord, tijme, sagar193, rustberry, johnini, jaidevshriram, and 6 more reacted with hooray emoji
ThaJay, Sm0rezDev, jasonandmonte, Ma7eer, kristineTabidze, and obipascal reacted with confused emoji
mrabubakar, amindadgar, firasmaarouf, leonardbos, lekiet1214, and cguerrave reacted with heart emoji
Grigoriy0 and leonardbos reacted with rocket emoji
Hey! Thanks for the tip. I’ll hear forward to know if this is going to be fixed.
@hacdias — Thanks for reporting this. Is manually starting MySQL using mysql start
working for you? Currently, in WSL we do not start the ‘upstart’ service and so you are seeing the failure. We are looking into supporting some of these servicesdeamons.
hacdias@HENRIQUE-PC:/mnt/c/Users/Henrique Dias$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I don’t think so
Same thing here
Maybe because of one of the new syscall support. I’ll create a virtual machine with the insider preview to test it. Thanks for letting us know that!
Same for me as well. Happened right after installation while tried to logging in. Build 14959.
Is the xenial based image officially supported yet ? I found some method to do the upgrade on the internet but people say this is neither supported by cannonical or windows
@Voluong — Yes, Xenial is officially supported in the Insider builds. It will be also be officially supported in the Windows Creators Update
release.
Hi
I have the same issue with Mysql.
sudo service mysql start
initctl: Impossible de se connecter à Upstart: Failed to connect to socket /com/ubuntu/upstart: Connexion refusée
/lib/lsb/init-functions.d/50-ubuntu-logging : ligne 5 : 214 Abandon (core dumped) plymouth —ping > /dev/null 2>&1
Starting MySQL database server mysqld /lib/lsb/init-functions.d/50-ubuntu-logging : ligne 5 : 671 Abandon (core dumped) plymouth —ping > /dev/null 2>&1
[ OK ]
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly.
With this
mysql —host=localhost —user=root -p
Enter password:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
Not exactly the same error with this
mysql —host=127.0.0.1 —user=root -p
Enter password:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
i try this
mysql -uroot -p —host=localhost —port=3308 —protocol=TCP
Enter password:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (111)
Build 15063.138
Need some help please… thank you!
This is a big problem for me right now. My usecase looks like this:
I’m handling my local development environment with AMPPS and the AMPPS GUI so the service is already running in the background and I can control it without using the terminal/cmd.
On my development stack I have an automated script for cloning database content from my remote host to my local machine and on OSX we’re using localhost
by default, which means I have to change the mysql host to 127.0.0.1 everytime when I want to work on some internal project and change it back to localhost later again.
Is there any progress on this issue? I would love to see it resolved asap since it’s not the expected behaviour (if no mysql server is running on the bash, I would like to rather connect to the one running in Windows directly).
Looking forward, thank you!
@DB2K your problem is not completely related to this issue. This issue was about the fact that in earlier builds of Bash on Ubuntu on Windows, not enough linux was emulated to successfully run MySQL. That has been fixed with newer builds.
Your issue is, in MySQL, localhost
is considered a special name and mysql will try to connect using unix socket instead of TCP/IP if you tell it to connect to localhost. If you run MySQL in Windows, that one is available through TCP/IP and named pipes, not through local socket.
You already found a workaround which is specifying 127.0.0.1 as the IP address which forces TCP/IP and then reaches the Windows MySQL.
Alternate solutions would be to specify a different hostname for your development environment in the hosts
file on your local machine and use that, in which case you need to change the configuration file in your script anyway, or to switch to using MySQL in the bash on ubuntu on windows, which might not be an option for you because you use AMPPS.
I guess the best solution for you might be to modify the automated script you have to take a parameter for the MySQL host location, so it’s not hard-coded to localhost
anymore. Maybe you can have it use an environment variable?
@mbeijen thanks for the information. It worked out with --protocol=tcp
but I had to rewrite some lines of the CLI until I got to the point where some parts weren’t editable.
Still looking for some better solution.
Bump. Same issue with a fresh MySQL2 install.
@danwhitston @Kubitomakita
I found a temporary solution. Open /etc/mysql/mysqld.conf.d/mysqld.conf
and add the following to the bottom of the file
This will force the mysql client to use TCP clients instead of unix sockets. That way you can connect to your localhost database running on Windows.
If you don’t need it as default, append --protocol=tcp
to the mysql command.
srauni and Hilbert-Yaa reacted with hooray emoji
jasonandmonte, srauni, alyssondaniel, and Hilbert-Yaa reacted with heart emoji
akramabdulrahman, Psypher9, jasonandmonte, srauni, Hilbert-Yaa, and iecoding reacted with rocket emoji
WSL now supports MySQL, so closing this issue. Refer to this comment — #745 (comment). Please re-open and provide additional details if you run into this issue again.
@tara-raj thats great to hear. will this be updated via Windows Store or come with the next major Windows update?
I had similar issue but slightly different. I can connect through unix socket but not through tcp. I checked mysql error log and it was very fine (it says server socket created on 127.0.0.1).
The problem was due to the Korean security programs for internet banking. Stopping entire security programs in services.msc and problem is solved.
Don’t know exactly what it is, but I think one of them interrupt tcp communication with port 3306.
How is this said to be fixed? I’m having the same issue.
Just dropping something related here:
Say you run mysqld
under Windows (Win64). And you want to connect from WSL. It will try to connect to through a socket file (named pipe), but that won’t work. Here’s how to do that:
You of course need to add all your own options (e.g -u <name> -p
).
You can set this as the default behaviour. sudo vim /etc/mysql/mariadb.conf.d/50-client.cnf
, under [client]
comment out the socket line with a #
, add a line that reads protocol = TCP
(to exit vim
, press [ESC] and type :wq
). The path of this file might be different with an actual Oracle MySQL install, instead of MariaDB.
Still trying to figure out how to do this from the various mysql drivers in PHP. The recommended way to connect to 127.0.0.1
to circumvent the localhost
heuristics doesn’t work with whatever artisan/laravel uses.
https://stackoverflow.com/a/55844865/273668
ghost
mentioned this issue
Nov 22, 2019
@mbeijen thanks for the information. It worked out with
--protocol=tcp
but I had to rewrite some lines of the CLI until I got to the point where some parts weren’t editable.![]()
Still looking for some better solution.
yea same, it works
$ mysql -u root -p —protocol=tcp
I still have this issue.
It neither works with --protocol=tcp
nor with sudo /etc/init.d/mysql start
. I’ve also made sure I’ve got no previously mysql installation on my system and no mysql processes are running.
DESKTOP*** ~$ sudo /etc/init.d/mysql start
[sudo] password for ***:
* /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
* Starting MySQL database server mysqld
No directory, logging in with HOME=/
@bdbch Unfortunately I’ve gone through some steps since when I commented here but fortunately I can say what I observed in each step and what I did afterwards for being clearer about my problem(Prior apologies: If a step is absurdly wrong, my linux knowledge isn’t deep)(Also sorry it’s got a bit long).
STEP1:
(answering to your question): Yes, but I get this error: Error writing /etc/mysql/mysqld.conf.d/mysqld.conf: No such file or directory
when I try to save that file (opened with sudo nano
).
I even cleaned up everything and installed mysql from scratch, as many answers suggest:
sudo apt-get remove --purge *mysql*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get remove --purge *mariadb*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt update
sudo apt upgrade
sudo apt-get install mysql-server
But still that configuration file doesn’t even exist for me.
STEP2:
I see that running mysql
says mysql.exe: command not found
, so I think the main problem is with finding the executable from PATH. But the /etc/bin/mysql
exists and also the /etc/bin
is in the PATH, so I don’t know why I get the command-not-found error when I run mysql
. Anyway, I run the /etc/bin/mysql
and it gives another error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Accidentally, I try sudo mysql
and it connects to the mysql server and shows the version 5.7. I.e., only adding the sudo
made it work! I am not a Linux guru but I [used to] think that when sudo
is needed I should get a permission error
and not a mysql.exe: command not found
.
STEP3:
I’m following a tutorial which is based on MySQL 8. So I think probably upgrading to MySQL version 8 might fix both of my issues. So I follow the instructions here Replacing a Native Distribution of MySQL Using the MySQL APT Repository. I add the MySQL APT repositories to my repository list and then apt update & re-install the mysql-server. This time, I get a window which asks about the version and I choose version 8. Installation finishes and sudo mysql --version
gives mysql Ver 8.0.20 for Linux on x86_64 (MySQL Community Server - GPL)
, HOWEVER, this time even sudo mysql
gives the error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
. Now even sudo
is not helping!
For future visitors, I fixed my problem with MySQL version 8 installation using this comment:
Direct installation of MySQL 8.x will not work on WSL, even after your have selected 8.x as the default install candidate. It has problem starting the server.
Steps below should work (tried out on few WSL instances):
Remove MySQL 8.x:
sudo apt-get purge mysql-server mysql-client
sudo apt-get -y autoremove
Change to MySQL 5.x candidate:
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
(if you don’t have it, get it from here: https://dev.mysql.com/downloads/repo/apt/)
Double check current apt policy of MySQL is 5.x:
sudo apt policy mysql-server (it will show 5.x is the default candidate)
sudo apt-get update
Install MySQL 5.x
sudo apt-get -y install mysql-server
sudo service mysql start (this should work without error)
Change to MySQL 8.x candidate
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb (select 8.x)
sudo apt-get update
sudo apt policy mysql-server (it will show 8.x is the default candidate)
Install MySQL 8.x
sudo apt-get -y install mysql-server
Modify a script as there is a bug
sudo nano /etc/init.d/mysql
(search for a line «. /usr/share/mysql/mysql-helpers» and change it to
«. /usr/share/mysql-8.0/mysql-helpers»)
Upgrade system tables to MySQL 8.x
sudo service mysql start (this should start without error)
sudo mysql -u root -p
I checked the error log in /var/log/mysql/error.log and realized there was a problem with this description «Linux Native AIO interface is not supported on this platform.» so I Googled it and bumped into the [very helpful] above comment. Hope this also works for you!
I have Windows 10 and Centos 7 Distro. I am getting the mysql 2002 error as well as apache is also failing once I restart the system. How I solved this is shown below:
My major issue is httpd directory is getting deleted in /run directory causing Apache Server to fail
Also /var/run folder is missing mysqld folder after restart which will block the creation of mysql.pid
So what we need to do is
`cd /run
sudo mkdir httpd
cd /var/run
sudo mkdir mysqld
sudo chown mysql:mysql mysqld
sudo service httpd start
sudo service mysqld start`
And the Server as well as MySQL should start.
[This issue is for MySQL 8]
Hope this helps some one.
[This is a temporary solution. To avoid repeating the process, add the above steps to a shell script and execute the shell script each time the WLS is invoked]
@aderchox Thank you, after reseting debian to remove the old mysql8 packages your solution worked
@aderchox’s answer helped me, I’m on windows 10 with wsl 2 running ubuntu 18.04. in my case the problem was in the installation of MySQL using the current apt .deb package, it proceeded with the installation but never added the mysql.sock file at /var/bin/mysql/ neither /var/lib/mysql/ .
Just adding to @aderchox’s answer, the link of mysql-apt-config_0.8.15-1_all.deb is here, and if there is a problem like «MySQL 8.x could not start» or something like that, just kill the process and start again the server
All,
I am receiving the above and below error message out of nowhere and I don’t know why.
OS: Linux 16.04 LTS
MariaDB server — 10.3
MariaDB client -10.3
MariaDB core — 10.3
I am using a «Galera» cluster setup, my master serve is having this issue but my slave is running fine. My slave is reading (111 «connection refused»). I assume this is because there is something wrong with MariaDB on the master and thus, it doesn’t allow the connection to happen. The error below refers to a «.sock» file but the only thing I can find on the interwebs regarding that file is that it is created when the service starts and deleted when the service stops. Please let me know if I am understanding the correctly or not. I have looked everywhere and it seems that there isn’t just 1 answer for my issue. This issue does persist after reboot as well. I am unable to get in to «MySQL» or even start the service, so I am unable to make any changes to anything.
ERROR::ERROR 2002 (HY000): Can’t Connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
Thanks Everyone,
- ↑ The Community ↑
Comments
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
-
Thread Starter
-
#4
SirDice I still got issue when trying to login
Code:
mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")
Why is the path set in
my.cnf
are not been considered? is that anything to do with the fact that I use zfs and I mounted mysql-innodb and mysql-innodb-logs?
Code:
zfs create zroot/DATA
zfs set mountpoint=none zroot/DATA
zfs create -o recordsize=8k zroot/DATA/mysql
zfs create -o recordsize=128k -o primarycache=metadata zroot/DATA/mysql/mysql-innodb-logs
zfs create -o recordsize=16k -o primarycache=metadata zroot/DATA/mysql/mysql-innodb
zfs set mountpoint=/iocage/jails/<bignum>/root/var/db/mysql zroot/DATA/mysql
zfs set mountpoint=none zroot/DATA
Changing it back to
socket = /tmp/mysql.sock
seem to work but I would like to understand if possible
Last edited by a moderator: Feb 14, 2016
I came upon this error after installing the latest version of MySQL using yum and securing it.
The Error
With mysqld
running I tried to run mysql
as follows:
[ahmed@amayem ~]$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Different failed attempts:
Here are more attempts to get it working:
[ahmed@amayem ~]$ telnet 127.0.0.1 3306
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
[ahmed@amayem ~]$ mysql -h 127.0.0.1
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
[ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
[ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306 -u root
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
[ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306 -u root -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
The Solution
[ahmed@amayem ~]$ cd /etc/init.d/
[ahmed@amayem init.d]$ ./mysqld stop
Stopping mysqld: [ OK ]
[ahmed@amayem init.d]$ sudo ./mysqld start
Starting mysqld: [ OK ]
Basically we just restarted mysqld
. Now the error changes:
[ahmed@amayem init.d]$ mysql
ERROR 1045 (28000): Access denied for user 'ahmed'@'localhost' (using password: NO)
This is good, now we just need to use a user that has access, like root that was made when we secured the install.
[ahmed@amayem init.d]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
And we are in.
The Reason (Conjecture)
Since it started working after manually restarting mysqld, I would have to guess that when it was restared it made /var/lib/mysql/mysql.sock
, which might have been missing. Unfortunately I didn’t check on its existence before, so I can’t confirm. If anyone has a reason please mention it in the comment section.
5 people found this article useful
5 people found this article useful