java - mariadb ERROR 1045 (28000)
大家讲道理
大家讲道理 2017-04-17 13:36:20
[Java讨论组]

1、 运行环境: mariadb

2、 操作系统: centos7

3、 问题如下

之前数据库设置的是有密码登陆,现在出现用密码不能登录,而无密码可以登录。登录后不能创建数据库。求原因

一下我的操作:

[root@localhost ~]# mysql -uroot -p123456
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [(none)]>

MariaDB [(none)]> create database test1;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'test1'
MariaDB [(none)]>

我试了网上的方法,如下:
1.关闭mysql
# systemctl stop maraidb.sevice
2.屏蔽权限
# mysqld_safe --skip-grant-table
屏幕出现: Starting demo from .....
3.新开起一个终端输入
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
mysql> \q

仍然不行,现在只能对数据库读,其他的操作都不能进行,求原因???

谢谢!!!

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号