Jr App Dev
#I have just installed Mysql server on Ubuntu 22.04 but everytime I try to start it I am experiencing errors:
-When I try to launch it using “sudo mysql” in the terminal I get the following error:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
-Using “sudo service mysql start” in the terminal I get:
Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xeu mysql.service” for details.
-When I run “systemctl status mysql service” I get the following output:
Unit service.service could not be found. × mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; preset: enabled) Active: failed (Result: exit-code) since Thu 2023-01-12 11:41:02 UTC; 22s ago Process: 32000 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) CPU: 5ms
Jan 12 11:41:02 appdev systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5. Jan 12 11:41:02 appdev systemd[1]: Stopped MySQL Community Server. Jan 12 11:41:02 appdev systemd[1]: mysql.service: Start request repeated too quickly. Jan 12 11:41:02 appdev systemd[1]: mysql.service: Failed with result ‘exit-code’. Jan 12 11:41:02 appdev systemd[1]: Failed to start MySQL Community Server.
#SO how can I solve this problem? Please help
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I’ve just tried this on a fresh new Ubuntu 22.04 Droplet and I installed MySQL with the following command:
sudo apt update -y
apt install mysql-server mysql-client
And then I was able to access MySQL with the following command:
mysql -h localhost
In your case, I would recommend checking the MySQL error log so that you could see what might be causing the problem. You can check the log with the following command:
tail -100 /var/log/mysql/error.log
Let me know how it goes!
Best,
Bobby
Hello @chiefagibu
Just to add something to what have already been mentioned. We have a tutorial on accessing MySQL error logs and troubleshooting MySQL errors which you can check here:
https://www.digitalocean.com/community/tutorials/how-to-access-mysql-error-logs
https://www.digitalocean.com/community/tutorial_series/how-to-troubleshoot-issues-in-mysql
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.