无法进入安全模式或设置 mysql root 密码新安装 ubuntu 18

无法进入安全模式或设置 mysql root 密码新安装 ubuntu 18

我尝试过重新安装,但似乎没有什么帮助

$ sudo mysqld_safe --skip-grant-tables &
[1] 8688
$ 2018-09-04T20:51:49.362162Z mysqld_safe Logging to syslog.
2018-09-04T20:51:49.365443Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2018-09-04T20:51:49.367974Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[1]+  Exit 1                  sudo mysqld_safe --skip-grant-tables
$ sudo mysqld_safe --skip-grant-tables
2018-09-04T20:52:07.496620Z mysqld_safe Logging to syslog.
2018-09-04T20:52:07.499628Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2018-09-04T20:52:07.502089Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

结果dpkg -L mysql-server

/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mysql-server
/usr/share/doc/mysql-server/copyright  
/usr/share/doc/mysql-server/NEWS.Debian.gz
/usr/share/doc/mysql-server/changelog.Debian.gz


jbarton@jbarton-Latitude-E7470:~/Code/signlab$ systemctl status mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor 
preset: enabled)
   Active: active (running) since Tue 2018-09-04 15:14:31 MDT; 20min ago
  Process: 9888 ExecStart=/usr/sbin/mysqld --daemonize --pid- 
   file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
  Process: 9879 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre 
(code=exited, status=0/SUCCESS)
 Main PID: 9890 (mysqld)
    Tasks: 28 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─9890 /usr/sbin/mysqld --daemonize --pid- 
   file=/run/mysqld/mysqld.pid

Sep 04 15:14:30 jbarton-Latitude-E7470 systemd[1]: Starting MySQL 
Community Server...
Sep 04 15:14:31 jbarton-Latitude-E7470 systemd[1]: Started MySQL 
Community Server.

答案1

我认为问题在于打开安全模式后我没有进入新的终端选项卡并且该进程在后台运行,打开新选项卡后我能够进入安全模式并更新密码,

相关内容