MySQL的:不能访问根或命令提示

问题描述 投票:1回答:2

Linux操作系统(Ubuntu的18.04)用户,使用this tutorial执行以下命令:

  807  sudo apt-get update
  808  sudo apt-get install mysql-server
  809  sudo ufw allow mysql
  810  systemctl start mysql
  811  systemctl enable mysql
  812  /usr/bin/mysql -u root -p

从最后一行的输出是:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

我得到没有-p相同的结果:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

有任何想法吗?我已经试过卸载并重新安装了几次,并在提示密码输入我是我的根密码。

编辑:我曾尝试既没有sudo,我仍然得到同样的结果

我的linux版本:

Distributor ID: Ubuntu
Description:    Bodhi Linux 5
Release:        18.04
Codename:       bionic

我的MySQL版本:

mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper
mysql ubuntu
2个回答
1
投票

杰西卡,我想从您提供的链接(Rackspace公司)的具体步骤。我使用18.04 LTS。当你调用mysql的步骤应该是下面。它的工作完美的罚款我。此外,在我的情况下mysql_secure_installation实用程序未自动运行。所以我不得不调用只是“须藤MySQL的”,然后更新的root用户的密码。

sudo mysql -u root -p

0
投票

我收拾我的系统:

sudo apt-get --purge autoremove mysql-server然后重新安装它按照教程,这个问题似乎已经解决。

© www.soinside.com 2019 - 2024. All rights reserved.