I'm new to the server configurations. I have a website hosted on an ubuntu server. The website tells me that it can't connect to the database. I logged in to the server and typed mysql and I get the following error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I also did sudo service mysql status and I get the following error
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2022-06-10 15:46:54 CEST; 8min ago
Process: 1400808 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 1400816 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
Main PID: 1400816 (code=exited, status=2)
Status: "Server is operational"
Jun 10 15:46:54 vm40565 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jun 10 15:46:54 vm40565 systemd[1]: Stopped MySQL Community Server.
Jun 10 15:46:54 vm40565 systemd[1]: mysql.service: Start request repeated too quickly.
Jun 10 15:46:54 vm40565 systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 10 15:46:54 vm40565 systemd[1]: Failed to start MySQL Community Server.
I tried multiple solutions from Stack Overflow but nothing works, I always get the ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Error.
Related
I wanted to import a sql dump
mysql -u username mydb < file.sql
And of course i get the classic ERROR 2006 (HY000) at line 1701: MySQL server has gone away message. No big deal i know that i need to increase the packet size. So i edit the /etc/mysql/mysql.cnf file and add the line max_allowed_packet=64M. But when i try to start the mysql server i get an error.
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-21 16:27:47 CET; 15s ago
Process: 9151 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 9112 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 27620 (code=exited, status=0/SUCCESS)
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jan 21 16:27:47 aleksandar-pc systemd[1]: Stopped MySQL Community Server.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Failed with result 'exit-code'.
If i remove the code added for packets, the server can be started normally.
Can anyone help me with this, i really need to import this large db and don't know how to fix this mysql error.
Mysql verison: Ver 14.14 Distrib 5.7.25, for Linux (x86_64)
Linux: Ubuntu 18.04 LTS
Ok i forgot this [mysqld] above:
[mysqld]
max_allowed_packet=128M
I'm trying to start the gammu sms service, when I run it with simple archives, it runs fine, but when I try to run it with the mysql database, it shows this error:
Error code: 2002, Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
The restart gammu-sms, show this message:
user2#Lubuntu18:~$ service gammu-smsd restart
user2#Lubuntu18:~$ service gammu-smsd status
● gammu-smsd.service - SMS daemon for Gammu
Loaded: loaded (/lib/systemd/system/gammu-smsd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-08-18 20:55:21 -04; 2min 52s ago
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
The log file gammu smsd show this:
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error connecting to database!
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error code: 2002, Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Initialisation failed, stopping Gammu smsd: Database connection timeout. (DB_TIMEOUT[78])
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Stopping Gammu smsd: Sin error. (NONE[1])
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
The /etc/gammu-smsdrc is:
# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
device = /dev/ttyUSB0
name = USB Qualcomm__Incorporated Qualcomm_CDMA_Technologies_MSM
connection = at
logfile = /home/ruser2/gammu.log
logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
runonreceive = /opt/lampp/htdocs/kalkun/scripts/daemon.sh
service = sql
Driver = native_mysql
PIN= 1234
logfile = /home/user2/gammusmsd.log
# Increase for debugging information
debuglevel = 0
user = kalkun
password = kalkun
pc = localhost
database = kalkun
I use Lubuntu:
18.04
xampp 5.6.30
PHP Version 5.6.23
Any idea to help me? thanks a lot
Your user has no permission, you started as user2#Lubuntu18.
Try to start gammu-smsd as root, or add permission dialout to user2.
sudo gammu-smsd -d --user gammu --group dialout
Firstly, I must say that I have not used these tools in the past so linux commands are not familiar to me.
Backstory:
On my Webmin server, I have been trying to get a Drupal Installation to work. I changed a parameter on the MySQL module and now the MySQL will not start.
Current Situation:
When I click "Start MySQL Server" I receive the follow:
Failed to start database : Redirecting to /bin/systemctl start
mariadb.service Job for mariadb.service failed because the control
process exited with error code. See "systemctl status mariadb.service"
and "journalctl -xe" for details.
I've search around this, and most people recommend to reinstall MariaDB.
I connected to the server with putty to get some more information
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-08-01 16:29:00 UTC; 7min ago
Process: 22851 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 22850 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 22823 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 22850 (code=exited, status=0/SUCCESS)
Aug 01 16:28:57 li172-89.members.linode.com systemd[1]: Starting MariaDB database server...
Aug 01 16:28:57 li172-89.members.linode.com mysqld_safe[22850]: 170801 16:28:57 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 01 16:28:57 li172-89.members.linode.com mysqld_safe[22850]: 170801 16:28:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: mariadb.service: control process exited, code=exited status=1
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: Failed to start MariaDB database server.
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: Unit mariadb.service entered failed state.
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: mariadb.service failed.
[root#li172-89 ~]#
I gather that this means Mariadb wont even start so I should probably reinstall it. I did try to simply use a defaul my.cnf but that didn't really do anything.
Ideally, I do not want to lose any of the databases I have.
What should I do? Should I reinstall Mariadb? Is there a suitable guide that lists the commands? Could I install Mariadb but to another folder?
What is the best course of action at this point?
So I've been working on a rails server with MySQL and suddenly can't access my database. When I try to log in with mysql -u root -p I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2). I've read most of the forums I can find and looked through all the logs trying to reset mysqld.sock. I've tried reinstalling and repackaging unsuccessfully. The weird thing is that var/run/mysqld/ doesn't even exist after reinstalling.
So I decided to just back up my databases and overhaul everything. I cleaned out both apache and mysql with apt-get remove --purge and reinstalled. All went fine, apache launched fine, and then tried to relaunch mysql with systemctl start mysql which gave a prompt to check the log which says:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2016-12-16 23:56:19 UTC; 17s ago
Process: 15690 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Control process exited, code=exited status=1
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Unit entered failed state.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Failed with result 'exit-code'.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Stopped MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Start request repeated too quickly.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Update - I created the folder mysqld, which seems to allow sudo mysqld --initialize to run. Unfortunately this yielded the error
2016-12-17T00:16:36.298825Z 0 [ERROR] Can't change data directory owner to mysql
2016-12-17T00:16:36.299212Z 0 [ERROR] Aborting
So no party yet. Any thoughts would be hugely appreciated.
edit /etc/mysql/conf.d/mysql.cnf :
sudo nano /etc/mysql/conf.d/mysql.cnf
add this line :
socket=/var/run/mysqld/mysqld.sock
then restart mysql service :
sudo service mysql restart
hi my mysql was working i did nothing on it then today when i went to login to multicraft it gave me error 500 which means theres an issue with mysql and i tried to do $service mysql restart it didnt work so i did $service mysql status and i got this error
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Wed 2016-01-27 16:39:39 CET; 24min >ago
Process: 27320 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 28147 ExecStart=/etc/init.d/mysql start (code=exited, >status=1/FAILURE)
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Starting LSB: Start and >sto...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu mysql[28147]: /etc/init.d/mysql: >ERROR:...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: mysql.service: control >proc...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Failed to start LSB: Start >...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Unit mysql.service entered >...
Hint: Some lines were ellipsized, use -l to show in full.
look in your /var/log/mysql/*.log logs
try to start mysql on the commandline
Example:
as root user: mysqld --console