gpt4 book ai didi

mysql - 我无法连接到我刚刚安装的 MySQL 服务器

转载 作者:行者123 更新时间:2023-11-29 10:34:57 24 4
gpt4 key购买 nike

我已经在 Ubuntu 16.04 上安装了 MySQL :

sudo apt-get install mysql-client-5.7 mysql-server-5.7

要检查安装情况,我运行以下命令:

mysql --version

mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper

还有:

 systemctl status mysql.service

● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-10-06 16:34:36 CEST; 28min ago
Process: 3521 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 3511 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 3520 (mysqld)
CGroup: /system.slice/mysql.service
└─3520 /usr/sbin/mysqld

Oct 06 16:34:35 SV1080AP1105 systemd[1]: Starting MySQL Community Server...
Oct 06 16:34:36 SV1080AP1105 systemd[1]: Started MySQL Community Server.

但是当我尝试连接时它不起作用!!!

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

最佳答案

试试这个:

    sudo grep 'temporary password' /var/log/mysqld.log

对于全新安装,MySQL 5.7 及以上版本会将临时密码保存在日志中。这可能会有所帮助。

然后使用密码,执行以下操作:

    sudo mysql -u root -p RETRIEVED_PASSWORD

关于mysql - 我无法连接到我刚刚安装的 MySQL 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46608749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com