微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

Centos7.5  刚安装的mariadb数据库报错

报错:

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

原因一:没有启动数据库

解决方法:
    systemctl start mariadb
    systemctl enable mariadb

原因二:未知

解决方法:
[root@db01 ~]# vim /etc/my.cnf
[MysqLd]
datadir=/var/lib/MysqL
socket=/var/lib/MysqL/MysqL.sock
skip-grant-tables  #在配置文件中加入这一条
[root@db01 ~]# systemctl restart mariadb    #重启数据库
[root@db01 ~]# MysqL  #登录成功
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server

copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 


  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐