Select Page
MySQL correct permissions

MySQL correct permissions

If somehow someone messes up the MySQL folder permissions and you need the MySQL correct permissions, they can be found below:

chmod -v 0751 /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
InnoDB: Ignoring tablespace for because it could not be opened.

InnoDB: Ignoring tablespace for because it could not be opened.

This one was a little tricky. The same system where the junior admin made a little mess of the MariaDB server, there was this long string of errors about “InnoDB: Ignoring tablespace for because it could not be opened.”  Apparently, somehow the db got deleted manually from the filesystem and we got left with a zillion of these:

2023-08-22 19:04:31 0 [Warning] InnoDB: Ignoring tablespace for `foo`.`core_layout_link` because it could not be opened.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Cannot open datafile for read-only: ‘./foo/core_layout_update.ibd’ OS error: 71
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Could not find a valid tablespace file for “foo`.`core_layout_update“. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2023-08-22 19:04:31 0 [Warning] InnoDB: Ignoring tablespace for `foo`.`core_layout_update` because it could not be opened.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Cannot open datafile for read-only: ‘./foo/core_resource.ibd’ OS error: 71
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Could not find a valid tablespace file for “foo`.`core_resource“. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2023-08-22 19:04:31 0 [Warning] InnoDB: Ignoring tablespace for `foo`.`core_resource` because it could not be opened.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Cannot open datafile for read-only: ‘./foo/paypal_ipn_log.ibd’ OS error: 71
2023-08-22 19:04:31 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2023-08-22 19:04:31 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2023-08-22 19:04:31 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2023-08-22 19:04:31 0 [ERROR] InnoDB: Could not find a valid tablespace file for “foo`.`paypal_ipn_log“. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.

Now, “foo” being the db name, apparently i need to recreate the file structure in /var/lib/mysql and then i can go ahead and restart the sql server and delete the db and everything should go back to normal.

Because they were too many of these, i had to do a little bash wizardry to automate the process and make it a little faster:

cat mysql.err |grep “Could not find a valid tablespace file” |cut -d ‘`’ -f 5 >> list

This would get me a list of the tables, while using ‘`’ as the delimiter for the field i was trying to find. i just cycled between the fields numbers before i got to the right one

So we go to the MySQL folder and re-create the foo db folder (where foo is the db name):

cd /var/lib/mysql

mkdir foo

Then i made this script, that would create the required files:

cd foo

nano x.sh

#!/bin/bash -x
list=$(cat ./list)

# Loopty loop
for item in $list; do
touch $item.frm
touch $item.ibd
done

chmod 700 x.sh

./x.sh

Now we have to adjust permissions on the db folder and the files inside:

cd /var/lib/mysql

chown -R mysql:mysql foo

restart mysql and go ahead and delete the foo db and the errors should be gone.

Cheers!

Can’t lock aria control file ‘/var/lib/mysql/aria_log_control

Apparently somehow they managed to start 2 instances of MariaDB that ran concurrently and they were each locking the files for another and this error kept popping in the log: “Can’t lock aria control file ‘/var/lib/mysql/aria_log_control”

Very surprised to see this one, but appeared on a server where a junior admin made a mess of a database, so i was called in to help.

In order to fix, i had to stop the monitoring scripts, and the automatic SQL restart, then i checked for all MySQL running processes, killed them, and started the db properly, while verifying in the logs to see if anything got broken due to the abrupt interruption.

A good practice after this is to run a repair on all databases, to make sure everything is in order

nmcli set nameservers (fix resolv.conf override)

If your /etc/resolv.conf gets overridden by NetworkManager on reboot, then you need to use nmcli to set nameservers in the way below:

1 – find the connection you want to edit

nmcli connection show

2 – add the nameservers

nmcli c modify “connection name” +ipv4.dns “8.8.8.8 9.9.9.9”

3 – reboot

Enjoy

curl: (60) SSL certificate problem: certificate has expired

curl: (60) SSL certificate problem: certificate has expired

if you’re trying to debug a website and you’re running some curl request and this might be a staging website or otherwise, with a self-signed ssl certificate maybe, then you could be running into: curl: (60) SSL certificate problem: certificate has expired

A real quick fix is to set curl to accept insecure connections by default in this manner:

echo “insecure” >> ~/.curlrc

Curl away!

Listening and understanding music – the conflict

Listening and understanding music – the conflict

Was talking to a friend of mine about a week ago, and he showed me this song, spoken in a foreign language. The song was on Youtube, and it had subtitles, therefore i was able to understand what was being sung. After listening to it for about 2 minutes, i realized it was something i was familiar with the message, and i told him that the song lost its meaning to me. He kept insisting that i should listen to it, with my heart, because it sounds good, and it makes him feel good when he listens.

i told him something which i don’t think he understood.

Yes, i will often listen to music that’s spoken in foreign languages. For the beat, for the vibe, it’s cool. Music speaks to everyone. i am particularly fond of Deutschrap because the beats are quite well. i was joking one day that these guys could be talking shit about my mother, but i’d still be enjoying the music because i don’t know the words.

However, one day, there was this song i particularly liked, and i made the mistake of going on Google, getting the lyrics, and translating them. Evidently, it was a mistake, because the beat was sick, but the lyrics were garbage and thus, the song got utterly ruined for me. Since then, i kinda really don’t translate any of the rap songs i end up listening to, unless maybe the video is that good or if it’s auto-subtitled.

Another day, in the suggested videos, came up this Egyptian rap video, which had a really nice color palette, white, orange, and blue, and the video itself was nicely made, showing around some neighborhood in Egypt. Now, as i liked the beat, and as i liked the imagery, i wanted to know the words. i was so pleasantly surprised to learn that the words were nice. It talked about their neighborhood – Talbeya, how girls can walk safely around it at night, how they grew pigeons on the rooftops of the buildings, how they passed around plates of food between the houses and it always comes back full, the workouts and so on.

So you can see how it all comes together – It was great when the beat, the vibe of the song, aligns with the imagery of the video, and then the meaning of the words being spoken completing this whole work.

Coming back to my friend, i explained that although that song had a nice vibe, as soon as i understood the message that it promoted, the song lost any meaning or value to me. By now, you should be able to understand why.

We also have to keep in mind, that the people singing the song, know the message they are singing, and they still choose to do it, even though it’s a terrible message, so it’s a conscious decision.

So now i ask: How can i in good judgment, continue listening with my heart to a song that although is well spoken, but then i realize the message is so disappointing?

Come to think of it, people have for centuries taken terrible messages, sung them, put them on pedestals, surrounded them by gold and crowns and riches, and then those messages, even if they were terrible on their own, people treated them as valuable, with respect and humility, not questioning them, their validity or the people that chose to promote those messages, so i guess that says something about the character of the majority of people. i guess it’s easier to shed responsibility for one’s actions and to think that if only …

Pin It on Pinterest