简体   繁体   中英

can't connect to any database after upgrading open-ssh

I upgraded open ssh with this command: sudo apt-get upgrade openssh-server

I rebooted the server and after that, I can't connect to any database (Wordpress database, you'll database, phpmyadmin database)

for Wordpress I get: Error establishing a database connection

for yourls I get: Incorrect DB config, or could not connect to DB

for phpmyadmin I get: mysqli_real_connect(): (HY000/2002): No such file or directory

WHat's the solution please!

I think that it's a mysql problem because it doesn't not start and when I check mysql.service I find that's failed

WHat's the solution please!

This is logs:

This is the error log /var/log/mysql/error.log

error.log page 2

mysql status

systemctl status mysql.service

journalctl -xe page 1

journalctl -xe page 2

journalctl -xe page 3

You can check MYSQL status by running following command

sudo /etc/init.d/mysql status

Or restart and try once

sudo /etc/init.d/mysql restart

If you still can not connect database you can change DB_HOST localhost to 127.0.0.1.

Finally, the solution was to go to: etc/mysql/mysql.conf.d/mysqld.cnf I found mysqld.cnf permission set to 644 I change it to 777 and the MySQL works again. I don't know why running the upgrade with this command sudo apt-get upgrade openssh-server changed many permissions to files and directories.

I think that 777 is too open, can I make a less permission without stoping MySQL? what permission do you advise me to both mysqld.cnf and my.cnf in those directories? etc/mysql/mysql.conf.d/mysqld.cnf and etc/mysql/my.cnf

welcome,

Try the permission 640 (rw-r-----) . That's the minimal permission required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM