MySQL error: "The partition with /var/lib/mysql is too full!" df -h shows otherwise
Always control services as root
.
While you can log in as root
to control a service, it isn't recommended.
Instead, use either:
sudo /etc/init.d/mysql restart
Or:
su -c "/etc/init.d/mysql restart"
The former requires the logged in user to be configured within sudo
. This involves being a member of a certain group - the group depends on the distro. The advantage is that the user will be using their own password.
The latter will involve the logged in user having the root
password to run the command.
jjacobson
Updated on September 18, 2022Comments
-
jjacobson over 1 year
my rented server is currently saying that mysql is too full when trying to start it when using /etc/init.d/mysql start. However using sudo /etc/init.d/mysql start it works normally.
Running df -h shows that there are no full partitions
Filesystem Size Used Avail Use% Mounted on rootfs 20G 1.5G 17G 9% / /dev/root 20G 1.5G 17G 9% / devtmpfs 32G 4.0K 32G 1% /dev none 4.0K 0 4.0K 0% /sys/fs/cgroup none 6.3G 752K 6.3G 1% /run none 5.0M 0 5.0M 0% /run/lock none 32G 0 32G 0% /run/shm none 100M 0 100M 0% /run/user /dev/md2 127G 11G 111G 9% /home
as requested df -i
Filesystem Inodes IUsed IFree IUse% Mounted on rootfs 1281120 45568 1235552 4% / /dev/root 1281120 45568 1235552 4% / devtmpfs 8242291 1516 8240775 1% /dev none 8250649 2 8250647 1% /sys/fs/cgroup none 8250649 1031 8249618 1% /run none 8250649 1 8250648 1% /run/lock none 8250649 1 8250648 1% /run/shm none 8250649 2 8250647 1% /run/user /dev/md2 8462336 990512 7471824 12% /home
I am confused because mysql claims its full when restarting normally, but then lets me restart it when using sudo, and df -h shows that there is plenty of space.
Thank you for the help.
-
Dom over 9 yearsCould you add a
df -i
? -
jjacobson over 9 years@Dom added df -i
-
garethTheRed over 9 yearsWhat do you mean "restarting normally, but then lets me restart it when using sudo"? Exactly what is "restarting normally"?
-
Pratap over 9 yearsCan you provide exact error with the restart command which you are using to restart?
-
jjacobson over 9 years@garethTheRed When not using sudo it fails to start and I get /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
-
jjacobson over 9 years@PratapSingh I get /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
-
garethTheRed over 9 yearsWhat command do you use when you're not using
sudo
? -
Pratap over 9 yearsin your df command we do not see any partition as /var/lib/mysql ? Can you check what is your datadir in my.cnf? provide output of command "ls -ald /var/lib/mysql/"
-
jjacobson over 9 years@PratapSingh That outputs drwx------ 7 mysql mysql 4096 Sep 17 02:31 /var/lib/mysql/
-
jjacobson over 9 years@garethTheRed The same command but without sudo "/etc/init.d/mysql restart"
-
garethTheRed over 9 yearsBut are you logged in as a normal user or as
root
? If the latter, why are you usingsudo
as root? (other than because it works of course!) -
jjacobson over 9 years@garethTheRed That's actually a good point. I was logged in as a normal user. Would that cause the "is full" error?
-
garethTheRed over 9 yearsI would expect it to complain about Permissions. I've just installed it on a Ubuntu VM and it does indeed also compain about the partition being too full! How odd :-). Anyway, always restart it as
root
and you'll be fine. -
jjacobson over 9 yearsWow thanks @garethTheRed That is really weird that it says its full.
-
jjacobson over 9 yearsThanks a lot for the help @PratapSingh, looks like it was a weird permissions thing. I am not sure why it would use that as the complaint instead of not having permissions.
-