English French
Then try accessing the MySQL prompt again. If you still receive the socket error, double check the location where your MySQL installation is looking for the socket file. This information can be found in the `mysqld.cnf` file:
look for the socket parameter in the [mysqld] section of this file. It will look like this:
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
Close this file, then ensure that the mysqld.sock file exists by running an ls command on the directory where SQL expects to find it:
ls -a /var/run/mysqld/
If the socket file exists, you will see it in this command’s output:
mysqld.pid mysqld.sock mysqld.sock.lock
if the file does not exist, the reason may be that MySQL is trying to create it, but does not have adequate permissions to do so. You can ensure that the correct permissions are in place by changing the directory’s ownership to the mysql user and group:
sudo chown mysql:mysql /var/run/mysqld/
Then ensure that the mysql user has the appropriate permissions over the directory. Setting these to 775 will work in most cases:
sudo chmod -R 755 /var/run/mysqld/
Finally, restart the MySQL service so it can attempt to create the socket file again:
sudo systemctl restart {mysqld|mariadb}
Then try accessing the MySQL prompt once again. If you still encounter the socket error, there’s likely a deeper issue with your MySQL instance, in which case you should review the error log to see if it can provide any clues.
**systemctl status mysqld.service** doesn't start well, This information doesn’t explain
well what is happening?, after this command you should type `journalctl -xe -u mariadb -u mysqld`.