Page 1 of 1
ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Mon Dec 19, 2022 3:22 pm
by ds1121
Hi
I am getting in a tangle trying to install mysql server 8 and wonder if someone could point me in the right direction please. I am basically new to installing it. I started by using MX package installer, which worked fine. Then it transpired that I need mysql 8 to be able to import a script with a particular collation. As far as I have been able to work out MariaDB does not support mysql 8.
So I installed mysql8 - I could not see it in the test repos - following these directions from 'superuser'-
https://superuser.com/questions/1703669 ... -debian-11 and in addition:
Code: Select all
dave@mx:~$ sudo mysql_secure_installation
It seemed to work:
Code: Select all
dave@mx:~$ mysql --version
mysql Ver 8.0.31-cluster for Linux on x86_64 (MySQL Cluster Community Server - GPL)
but then
Code: Select all
dave@mx:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
A stackoverflow post suggested checking the configuration files. That thread is 10 years though.
https://stackoverflow.com/questions/116 ... et-var-run
The line "socket = /var/run/mysqld/mysqld.sock" is in mysqld.cnf, in the folder /etc/mysql/mysql.conf.d
However, there is no mysqld folder at that location - or anywhere else that I can find.
Also,possibly related but I can't work out how:
Code: Select all
dave@mx:~$ mysqld
Command 'mysqld' is available in the following places
* /sbin/mysqld
* /usr/sbin/mysqld
The command could not be located because '/usr/sbin:/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
mysqld: command not found
I feel much like I do when I go to IKEA: I'm sure all the parts are there but I don't have the skills to assemble them.
Many thanks for any help, including ripping it up and doing it differently.
system info:
Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-20-amd64
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4710HQ CPU @ 2.50GHz
Memory: 15.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 4600
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Mon Dec 19, 2022 3:51 pm
by Eadwine Rose
Please share your quick system info, found in the menu, thanks.
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Mon Dec 19, 2022 3:57 pm
by ds1121
Hi
I obtained the info posted at the bottom of my post by selecting 'system info > copy to clipboard' - is that not right?
Best wishes
Dave S
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Mon Dec 19, 2022 4:55 pm
by Amiga-MX
In the app finder (menu mx) search for something like "información rápida del sistema" (I have spanish MX) or something like "quick system info" if you have english MX.
Follow the easy instructions, that program is really prepared to copy all info on the clipboard to report then here on the forum just by pasting.
It seems you are on Debian GNU/Linux 11, if that's true, I don't know how to do it.
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Mon Dec 19, 2022 5:04 pm
by markol
@ds1121 I believe I had this same error some time ago... IIRC you have to change the bind address from 127.0.0.1 to localhost in my.cnf (should be in /etc/mysql/, but check subdirectories also)
Also check if changing socket to /var/lib/mysql/mysql.sock helps (and/or maybe changing the permissions on this folder as well)
If not, try to find the location of this sock (can't stop giggling)
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Tue Dec 20, 2022 1:48 am
by Eadwine Rose
After you have run Quick System Info, click Copy for forum, and then click paste in a reply. Don't edit.
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Tue Dec 20, 2022 11:56 am
by ds1121
Hi
sorry I pasted from system info rather than quick system info
Code: Select all
System: Kernel: 5.10.0-20-amd64 [5.10.158-2] x86_64 bits: 64 compiler: gcc v: 10.2.1
parameters: BOOT_IMAGE=/boot/vmlinuz-5.10.0-20-amd64
root=UUID=<filter> ro silent splash quiet hush loglevel=0
Desktop: KDE Plasma 5.20.5 info: latte-dock wm: kwin_x11 vt: 7 dm: SDDM
Distro: MX-21.2.1_KDE_x64 Wildflower 27 August 2022
base: Debian GNU/Linux 11 (bullseye)
Machine: Type: Desktop System: Micro-Star product: GE60 2PE v: REV:1.0 serial: <filter>
Mobo: Micro-Star model: MS-16GF v: REV:0.B serial: <filter> UEFI: American Megatrends
v: E16GFIMS.52D date: 04/13/2015
Battery: ID-1: BAT1 charge: 47.2 Wh (100.0%) condition: 47.2/47.5 Wh (99.3%) volts: 12.5
min: 10.8 model: MSI PC-VP-BP77 type: Li-ion serial: N/A status: Full
CPU: Info: Quad Core model: Intel Core i7-4710HQ bits: 64 type: MT MCP arch: Haswell
family: 6 model-id: 3C (60) stepping: 3 microcode: 28 cache: L2: 6 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 39911
Speed: 2495 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 2495 2: 2495 3: 2495
4: 2495 5: 2496 6: 2495 7: 2495 8: 2494
Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: mmio_stale_data status: Unknown: No mitigations
Type: retbleed status: Not affected
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW, STIBP:
conditional, RSB filling, PBRSB-eIBRS: Not affected
Type: srbds mitigation: Microcode
Type: tsx_async_abort status: Not affected
Graphics: Device-1: Intel 4th Gen Core Processor Integrated Graphics vendor: Micro-Star MSI
driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:0416 class-ID: 0300
Device-2: NVIDIA GM107M [GeForce GTX 860M] driver: N/A alternate: nvidia
bus-ID: 01:00.0 chip-ID: 10de:1392 class-ID: 0302
Display: x11 server: X.Org 1.20.14 compositor: kwin_x11 driver: loaded: modesetting
unloaded: fbdev,vesa display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2")
s-diag: 582mm (22.9")
Monitor-1: eDP-1 res: 1920x1080 hz: 60 dpi: 142 size: 344x194mm (13.5x7.6")
diag: 395mm (15.5")
OpenGL: renderer: Mesa Intel HD Graphics 4600 (HSW GT2) v: 4.6 Mesa 22.0.5
compat-v: 3.1 direct render: Yes
Audio: Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel bus-ID: 00:03.0 chip-ID: 8086:0c0c class-ID: 0403
Device-2: Intel 8 Series/C220 Series High Definition Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20 class-ID: 0403
Sound Server-1: ALSA v: k5.10.0-20-amd64 running: yes
Sound Server-2: PulseAudio v: 14.2 running: yes
Network: Device-1: Qualcomm Atheros Killer E220x Gigabit Ethernet vendor: Micro-Star MSI
driver: alx v: kernel port: d000 bus-ID: 03:00.0 chip-ID: 1969:e091 class-ID: 0200
IF: eth0 state: down mac: <filter>
Device-2: Intel Wireless 3160 driver: iwlwifi v: kernel modules: wl port: d000
bus-ID: 05:00.0 chip-ID: 8086:08b3 class-ID: 0280
IF: wlan0 state: up mac: <filter>
Bluetooth: Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8
bus-ID: 1-1.3:3 chip-ID: 8087:07dc class-ID: e001
Report: hciconfig ID: hci0 rfk-id: 1 state: up address: <filter> bt-v: 2.1 lmp-v: 4.0
sub-v: f00 hci-v: 4.0 rev: f00
Info: acl-mtu: 1021:5 sco-mtu: 96:6 link-policy: rswitch hold sniff
link-mode: slave accept service-classes: rendering, capturing, object transfer, audio
Drives: Local Storage: total: 1.03 TiB used: 372.19 GiB (35.4%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000LM048-2E7172 size: 931.51 GiB
block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 5400
serial: <filter> rev: 0001 scheme: GPT
ID-2: /dev/sdb maj-min: 8:16 vendor: Toshiba model: THNSNJ128GMCU size: 119.24 GiB
block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter>
rev: 0102 scheme: GPT
Partition: ID-1: / raw-size: 118.99 GiB size: 116.57 GiB (97.96%) used: 14.24 GiB (12.2%) fs: ext4
dev: /dev/sdb2 maj-min: 8:18
ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%) used: 274 KiB (0.1%) fs: vfat
dev: /dev/sdb1 maj-min: 8:17
ID-3: /home raw-size: 912.89 GiB size: 897.48 GiB (98.31%) used: 357.95 GiB (39.9%)
fs: ext4 dev: /dev/sda2 maj-min: 8:2
Swap: Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: partition size: 18.63 GiB used: 0 KiB (0.0%) priority: -2
dev: /dev/sda1 maj-min: 8:1
Sensors: System Temperatures: cpu: 29.8 C mobo: 27.8 C
Fan Speeds (RPM): N/A
Repos: Packages: note: see --pkg apt: 3031 lib: 1575 flatpak: 0
No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
1: deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
Active apt repos in: /etc/apt/sources.list.d/debian.list
1: deb http://deb.debian.org/debian/ bullseye main contrib non-free
2: deb http://security.debian.org/debian-security/ bullseye-security main contrib non-free
Active apt repos in: /etc/apt/sources.list.d/mx.list
1: deb http://mxlinux.mirrors.uk2.net/packages/mx/repo/ bullseye main non-free
2: deb http://mxlinux.mirrors.uk2.net/packages/mx/repo/ bullseye ahs
Active apt repos in: /etc/apt/sources.list.d/mysql.list
1: deb http://repo.mysql.com/apt/debian/ bullseye mysql-apt-config
2: deb http://repo.mysql.com/apt/debian/ bullseye mysql-cluster-8.0
3: deb http://repo.mysql.com/apt/debian/ bullseye mysql-tools
4: deb-src http://repo.mysql.com/apt/debian/ bullseye mysql-cluster-8.0
No active apt repos in: /etc/apt/sources.list.d/pgadmin4.list
No active apt repos in: /etc/apt/sources.list.d/postgresql.list
Info: Processes: 258 Uptime: 15m wakeups: 2 Memory: 15.55 GiB used: 2.3 GiB (14.8%)
Init: SysVinit v: 2.96 runlevel: 5 default: 5 tool: systemctl Compilers: gcc: 10.2.1
alt: 10 Client: shell wrapper v: 5.1.4-release inxi: 3.3.06
Boot Mode: UEFI
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Wed Dec 21, 2022 3:03 pm
by ds1121
Hi
If not, try to find the location of this sock (can't stop giggling)
I can't find the location of even one sock.... (searching on *.sock)
you have to change the bind address from 127.0.0.1 to localhost in my.cnf
there is no bind address in my.cnf
Also if I try:
Then mysql does not appear on the list at all, so I'm assuming this is the problem - it does not exist as a service. But why I don't know. So as far as I can work out I have an installed server because of:
Code: Select all
dave@mx:~$ mysql --version
mysql Ver 8.0.31-cluster for Linux on x86_64 (MySQL Cluster Community Server - GPL)
but it is not recognised as it not on the list of services. But on the other hand - as far as my very limited knowledge takes me - a service is a daemon and I have a file called mysqld in /usr/sbin.
I wonder if it is something to do with MX Linux not using systemd? That is an absolutely wild guess based on no technical expertise, but it's all I have left at the moment.
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Wed Dec 21, 2022 4:35 pm
by markol
ds1121 wrote: Wed Dec 21, 2022 3:03 pm
Hi
If not, try to find the location of this sock (can't stop giggling)
I can't find the location of even one sock.... (searching on *.sock)
you have to change the bind address from 127.0.0.1 to localhost in my.cnf
there is no bind address in my.cnf
I checked on my RPi "server" running mariadb (on raspbian). The relevant config is in /etc/mysql/mariadb.conf.d/50-server.cnf
Code: Select all
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
#skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
Re: ERROR 2002 (HY000): Can't connect to local MySQL server
Posted: Thu Dec 22, 2022 3:56 pm
by ds1121
Hi
thank you for your time. I need to go away and have a good read of the mysql documentation, so I gain a better all-round understanding rather than fumbling around each individual issue,it does not seem like a quick fix. I have got as far as finding the settings in mysqld.cnf in /etc/mysql/mysql.conf.d/:
Code: Select all
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
so I have a good starting place, thank you.