Mysql 更新后无法工作,显示活动(已退出)

Mysql 更新后无法工作,显示活动(已退出)

我将 ubuntu 从 18.04 更新到了 20.04,mysql 不再工作了。phpmyadmin 显示 mysqli_real_connect(): (HY000/2002): 没有这样的文件或目录。

我应该怎么办?

提前致谢。

15:23:36 j0 wormball@wormball-desktop:~$ sudo service mysql stop 
15:23:47 j0 wormball@wormball-desktop:~$ sudo service mysql start 
15:23:49 j0 wormball@wormball-desktop:~$ systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
     Loaded: loaded (/etc/init.d/mysql; generated)
     Active: active (exited) since Wed 2020-10-14 15:23:49 MSK; 1s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1159338 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)

окт 14 15:23:49 wormball-desktop systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
окт 14 15:23:49 wormball-desktop systemd[1]: Started LSB: Start and stop the mysql database server daemon.
15:23:51 j0 wormball@wormball-desktop:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
15:24:40 j0 wormball@wormball-desktop:~$ mysqladmin -u root -p status
Enter password: 
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

15:13:29 j0 wormball@wormball-desktop:~$ cat /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

!includedir /etc/mysql/conf.d/

15:14:59 j0 wormball@wormball-desktop:~$ cat /etc/mysql/conf.d/*
[mysql]
[mysqld_safe]
syslog
[mysqldump]
quick
quote-names
max_allowed_packet  = 16M```

答案1

原来是mysql-server没有安装。

sudo apt install mysql-server

相关内容