Cannot run MySQL - no subdirectory .../mysqld - no mysqld.sock
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Several days later, I installed another software package using the Muon utility, and after Muon had done what I asked, it went on to install MySQL--and succeeded.
I was able to open MySQl as root and create a new user for myself. However, I have always kept my data files in a different location (in order to simplify my daily data backups). When I edited the /etc/mysql/mysql.conf.d/mysqld.cnf file to point to the new datadir, then edited /etc/apparmor.d/tunables to point the alias to the new datadir, the MySQL became unusable.
I get the following error message:
Code:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
On examination, I find that the subdirectory /var/run/mysqld does not exist. I can create it, set its owner:group to mysql: root and change permissions to 777 (rwxrwxrwx), but I still get the same response when I try to run MySQL. And when I look at the /var/run/ directory listing, I find that the .../mysqld/ subdirectory I created has been deleted.
Any ideas where I should look for a solution to allow MySQL to run?
If there's no mysqld.sock, then mysqld is not running.
That file is created when the daemon (mysqld) is running. You don't (and shouldn't) create it yourself.
I don't know if Lubuntu is SysV or systemd, so can't help you with starting the daemon...
but that's the problem: mysqld is not running, so you can't connect to it.
According to the table on Distrowatch.com, Lubuntu uses systemd.
Does that tell you where you might point me, to learn more about the failure of mysqld to run?
According to the table on Distrowatch.com, Lubuntu uses systemd.
Does that tell you where you might point me, to learn more about the failure of mysqld to run?
I recently re-installed mariadb unto Mint19.2. As a personal preference, I avoid using LAMP. I also experimented with Lubuntu for a short period of time and found it to be deficient. But that is just a personal observation.
I'm quickly becoming a true believer, in re: systemd and systemctl.
Running the command you suggested, I get:
Code:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-08-27 20:35:39 EDT; 29min ago
Process: 17923 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 17932 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Aug 27 20:35:39 Atlantis systemd[1]: mysql.service: Service RestartSec=100ms expired, scheduling restart.
Aug 27 20:35:39 Atlantis systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Aug 27 20:35:39 Atlantis systemd[1]: Stopped MySQL Community Server.
Aug 27 20:35:39 Atlantis systemd[1]: mysql.service: Start request repeated too quickly.
Aug 27 20:35:39 Atlantis systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 27 20:35:39 Atlantis systemd[1]: Failed to start MySQL Community Server.
That didn't see particularly informative, though I may be missing something important. However, back when I first tried the old routine to change my data directory, the last step was to invoke
Code:
service mysql start
and when I did that, I was directed to explore both
Code:
systemctl status mysql.service
(which showed me much the same information as I list above) and
Code:
journalctl -xe
which initially didn't seem much more informative until I learned that it displays its results much like the less utility. When I scrolled up, I found a line that looks a bit suspicious:
I undid all the changes, restarted apparmor, and started MySQL -- and I have MySQL back again. I thought I'd tried this approach before, but the difference this time is that instead of commenting-out my changes and un-commenting the original configuration lines (as I had done before), I actually deleted the changes and reinstated the originals.
Here's what I had changed (and, now, un-changed):
In /etc/mysql/mysql.conf.d/mysqld.cnf
In /etc/apparmor.d/tunables/alias I added the line:
Code:
alias /var/lib/mysql/ -> /libdata/mysql/,
Then I issued the following commands:
Code:
systemctl restart apparmor
service mysql start
I made those changes because I have a large, separate partition on which I mount my /libdata directory in which to store all my data (documents, spreadsheets, drawings, DTP files, etc., as well as MySQL database files) so that my daily back-up cron-job can do its job simply, and so that when I upgrade to a new LTS version of the OS, all my data is safely apart from whatever the OS-installer wants to fiddle with.
And, BTW, I found no mysqld.log anywhere on the HDD.
Last edited by qajaq; 08-28-2019 at 12:29 PM.
Reason: Add response to one additional suggestion
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.